Closed orkonet closed 6 years ago
How do I read 3 analog channels (AN0, AN1 and AN2) in a loop forever? RASPBERRY PI 3 ARDUINO ONE FIRMATA-AIO
Thank you for your help and guidance in this regard. I've tried but I'm not successful. The reading is unstable and the values are wrong.
`` import time
from PyMata import PyMata from pymata_aio.pymata3 import PyMata3 from pymata_aio.constants import Constants board = PyMata3() CANAL_ADC = 1 board.set_pin_mode(CANAL_ADC, Constants.ANALOG) while True: analog = board.analog_read(CANAL_ADC) voltage = analog * 3.3 print("Reading=%.2f\tVoltage=%.2f" % (analog, voltage)) time.sleep(.5) ``
Here is a link to some code that should read a0, a1, and a2 and print the results https://gist.github.com/MrYsLab/38bd302f50ef0f1ed77b90166ca485d2
Please let me know if that solves your problem.
How do I read 3 analog channels (AN0, AN1 and AN2) in a loop forever? RASPBERRY PI 3 ARDUINO ONE FIRMATA-AIO
Thank you for your help and guidance in this regard. I've tried but I'm not successful. The reading is unstable and the values are wrong.
`` import time
from PyMata import PyMata from pymata_aio.pymata3 import PyMata3 from pymata_aio.constants import Constants board = PyMata3() CANAL_ADC = 1 board.set_pin_mode(CANAL_ADC, Constants.ANALOG) while True: analog = board.analog_read(CANAL_ADC) voltage = analog * 3.3 print("Reading=%.2f\tVoltage=%.2f" % (analog, voltage)) time.sleep(.5) ``