from machine import Pin, ADC, PWM
# import time
from utime import sleep
# time.sleep(0.1)
sleep(0.1)
print("Hello, Pi Pico!")
pb1 = Pin(6, Pin.IN, Pin.PULL_UP)
pb2 = Pin(7, Pin.IN, Pin.PULL_DOWN)
led = Pin(5, Pin.OUT)
adc = ADC(26)
pwm = PWM(Pin(15))
pwm.freq(5000)
while True:
# write pin
# led.value(1)
# sleep(1)
# led.value(0)
# sleep(1)
# blink
# led.toggle()
# sleep(0.3)
# read pin
# print(pb1.value(), end='\t')
# print(pb2.value())
# sleep(0.5)
# control led from pb
# led.value(not pb1.value())
# adc reading
# value = adc.read_u16()
# print("adc : ", value)
# sleep(0.1)
# pwm led
# for duty in range(0, 65535, 129):
# pwm.duty_u16(duty)
# sleep(0.01)
# print(duty)
# for duty in range(65535, 0, -129):
# pwm.duty_u16(duty)
# sleep(0.01)
# print(duty)