Reputation: 1
I figured out that gpio.input & gpio.output are only supported in py. How can I get a same result in nodejs? read only return 0,1 which is useless in photocell sensor in raspberry pi.
Upvotes: 0
Views: 118
Reputation: 11
you might have a look at this node module package : rpi-gpio.
But unfortunatly for you, the only value you will receive from this input will be either 0 or 1 because you can not perform analog reading on GPIO on RPi. A solution is to buy a little module which can read analog and then write it in a serial communication to read it with RPi.
If you don't want to buy that kind of module there is a tricks which use a capacitor and then computes the time between two ones to know the value between 0 and 1024 for example. This article explains that well : capacitor analog
Upvotes: 1