Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
read line sensor
import machine
import utime
line = machine.ADC(26) # set pin 26 as analog INPUT
def read_line_sensor: # read line sensor function
return line.read_u16()
while True:
print(read_line_sensor()) # print line sensor value
utime.sleep(1) # sleep 1 second
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment