I need your help again.
I want to read the ADC with a constant frequenz and I found the adc.read_timed(buf, freq) function and this example
Example: http://docs.micropython.org/en/latest/l ... read_timed
Code: Select all
adc = pyb.ADC(pyb.Pin.board.X19) # create an ADC on pin X19
buf = bytearray(100) # create a buffer of 100 bytes
adc.read_timed(buf, 10) # read analog values into buf at 10Hz
# this will take 10 seconds to finish
for val in buf: # loop over all values
print(val) # print the value out
"name array is not defined"
Code: Select all
adc = pyb.ADC(pyb.Pin('X19')) # create an ADC on pin X19
buf = array.array('H') # create a buffer of 100 bytes
print(buf)
adc.read_timed(buf, 10) # read analog values into buf at 10Hz
while not switch():
print(buf)
pyb.delay(200)