The script is as bellow:
Code: Select all
from pyb import Pin, ADC
import time
f = open('datafile.txt', 'a')
adc = ADC(Pin('A1'))
for i in range(0,100):
tm1 = pyb.millis()
sample = adc.read()
if sample > 100:
f.write(str(tm1) + "," + str(sample) +'\n')
f.close()