I wrote a basic code for reading values from analog pin 0(I have a light sensor attached to it and the output is coming at analog pin 0) in python3 using pyfirmata, but it is giving the output as none no matter what. I tried the same code in arduino IDE and that is giving the right answer. Please help.
Code is :
from pyfirmata import Arduino, util
import time
board = Arduino('/dev/cu.usbmodem1411')
it = util.Iterator(board)
it.start()
board.analog[0].enable_reporting()
while True :
print (board.analog[0].read())
time.sleep(1)
Even when it gives an output after few seconds, it gives 0.29 which isn't actually the sensor value that comes on serial monitor. That value varies between 0 and 1023 and is relatively quite larger than this.