Skip to content

Instantly share code, notes, and snippets.

@Bhavithiran97
Created February 5, 2021 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bhavithiran97/2377f28915a1e310dfe1f3d68d32173c to your computer and use it in GitHub Desktop.
Save Bhavithiran97/2377f28915a1e310dfe1f3d68d32173c to your computer and use it in GitHub Desktop.
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