from machine import ADC
from machine import Pin
import time
red = Pin(4, Pin.OUT)
button = Pin(15, Pin.IN, Pin.PULL_DOWN)
# GP26(ADC0) 핀에 아날로그 센서(가변저항) 연결
sensor = ADC(26)
def read_sensor_percentage():
raw_value = sensor.read_u16() # 0~65535 아날로그 값 읽기
percentage = int((raw_value / 65535) * 100)
return percentage
sensor_val = read_sensor_percentage()
#sensor_val
while True:
if button.value() == 1:
print("SYSTEM이 준비되었습니다.")
ans = input("상태(ON/OFF/EXIT)를 입력하세요.")
print("상태:", ans)
if ans == "ON":
print("safasfasfsad")Loading
pi-pico-w
pi-pico-w