Code: Select all
from pyb import ADC
import pyb
if __name__ == "__main__":
switch = pyb.Switch()
pyb.delay(5000)
if switch():
pot_1 = ADC(pyb.Pin.board.X7)
pot_2 = ADC(pyb.Pin.board.X8)
while True:
print("pot_1:", pot_1.read(), "pot_2", pot_2.read())
pyb.delay(1000)
If the order of the declarations is changed then it is the pot on X7 that has the effect (i.e. the last ADC pin configured is effective). I tried it on X11 and X12 as well, with the same result.
Could this be a bug in the ADC class or am I not using it correctly?