because these are Light Dependent Resistors, a 10kΩ resistor is used to complete a resistive divider to read the sensors with an ADC.
In [4]:
!ls /dev/ttyACM*
In [1]:
import time
from pyfirmata import Arduino, util
import pyfirmata
board = Arduino('/dev/ttyACM0')
it = util.Iterator(board)
it.start()
for an in board.analog:
an.enable_reporting()
def readan(an):
return an.read()
In [2]:
%%timeit
for an in board.analog:
an.read()
In [3]:
%timeit map(readan, board.analog)
In [69]:
map(readan, board.analog)
Out[69]: