메인
home
소프트웨어
home

[피코-미디어파이프-시리얼통신][계성고][이정후]

[과제명][학교][이름] 바꿔주세요, 과제태그를 선생님 설명 듣고 넣어주세요.

1. 시리얼 통신으로 피코 제어

실습 1. 내부 LED 제어 코드
from machine import Pin import sys # 내장 LED는 일반적으로 GP25에 연결되어 있음 led = Pin("LED", Pin.OUT) print("UART LED Controller Ready") print("Type 'on' to turn on the LED, 'off' to turn it off") while True: try: # 한 줄 입력 받기 (터미널에서) command = sys.stdin.readline().strip().lower() if command == "on": led.value(1) print("LED ON") elif command == "off": led.value(0) print("LED OFF") else: print("Unknown command. Type 'on' or 'off'.") except Exception as e: print("Error:", e)
JavaScript
복사

2.미디어파이프로 라즈베리 피코 제어