Read rpi pico with podmeters for params

This commit is contained in:
Ruben van de Ven 2024-10-18 18:01:54 +02:00
parent 1f1c163fca
commit bb5c89f15e

14
main.py Normal file
View file

@ -0,0 +1,14 @@
from machine import Pin, ADC #importing Pin and ADC class
from time import sleep #importing sleep class
potentiometer1 = ADC(28) #creating potentiometer object
potentiometer2 = ADC(27) #creating potentiometer object
potentiometer3 = ADC(26) #creating potentiometer object
led = Pin('LED', Pin.OUT)
while True:
led.value(not led.value())
potentiometer_value1 = potentiometer1.read_u16() / 65536 #reading analog pin
potentiometer_value2 = potentiometer2.read_u16() / 65536 #reading analog pin
potentiometer_value3 = potentiometer3.read_u16() / 65536 #reading analog pin
print(potentiometer_value1, potentiometer_value2, potentiometer_value3)
sleep(0.05)