View Categories

Mengkontrol LED Dengan Potensio Di Pi Pico

Persiapan Bahan #

– Raspberry Pi Pico / Pico W
– Potentiometer
– Breadboard
– LED
– Resistor 220-Ohm
– Kabel Jumper Male to Male
– Kabel Micro USD
– Aplikasi Thonny IDE

Wiring LED & Potentiometer Di Raspberry Pi Pico #

Sample Code #

#Include the library files
from machine import ADC, Pin,PWM
from time import sleep

led = PWM(Pin(2))#Include the LED pin
potentiometer = ADC(28)#Include the potentiometer pin
led.freq(1000)#Set the frequency

while True:
    value = potentiometer.read_u16()#Get the values
    print(value)#Print value on the shell
    led.duty_u16(value)#Turn the LED ON and OFF
    sleep(0.2)#Set the delay time
What are you looking for in Partdo?