본문 바로가기

반응형

라즈베리파이 피코

라즈베리파이 피코 : TFT ILI9341 터치 디스플레 1. 2.8인치 TFT ILI9341 터치 디스플레이(참고: https://diyprojectslabs.com/raspberry-pi-pico-tft-lcd-touch-screen-tutorial/) - 회로- 핀맵핑- ili9341.py : 라즈베리파이 피코에 저장한다.https://diyprojectslabs.com/raspberry-pi-pico-tft-lcd-touch-screen-tutorial/ """ILI9341 LCD/Touch module."""from time import sleepfrom math import cos, sin, pi, radiansfrom sys import implementationfrom framebuf import FrameBuffer, RGB565 # typ.. 더보기
라즈베리파이 피코 - 신호등 만들기 LED 3개, 버튼 1. 회로도빨강 LED : 28노랑 LED : 27녹색 LED : 26버튼 : 16 2. 소스코드 : LedButton.py- LED가 순서대로 켜지고 버튼을 누를 때 마다 빨강, 노랑, 녹색 순으로 켜진다.from picozero import LED, Buttonfrom time import sleep, time# 버튼과 신호등 초기화button = Button(16) # GPIO 핀 16에 연결된 버튼을 설정# 신호등 및 관련 타이밍 설정lights = [ LED(28), LED(27), LED(26)] # 빨강, 노랑, 초록 순서의 신호등 리스트durations = [5, 3, 10] # 각 신호등이 켜져 있을 시간 (초)light_no = 0 # 현재 신호등 인덱스signal_no = 0 #.. 더보기
라즈베리파이 피코 - LCD https://m.blog.naver.com/icbanq/223008861202 1. LCD 연결하기- VCC : 3.3V(전압이 부족하면 안정적으로 5V를 공급하는 VBUS)- GND : GND- SDA : GP4 번- SCL : GP5 번 -I2C 주소 스캔하기from machine import Pin, I2Ci2c = I2C(0, scl=Pin(5), sda=Pin(4))print(i2c.scan())- 결과값이 39라면 주소는 0x27 - lcd_api.py# lcd_api.pyimport timeclass LcdApi: def __init__(self, num_lines, num_columns): self.num_lines = num_lines self.num_.. 더보기
라즈베리파이 피코 - 초음파센서 활용하기 1. 초음파센서 거리 측정하기- VCC : VBUS- GND : GND- Trigger : GPIO 12번- Echo : GPIO 20번# VCC는 VBUS에 GND는 GND에 연결, Trig는 12번, Echo는 20번 핀에 연결from machine import Pinimport time# 트리거 핀과 에코 핀 설정trigger_pin = Pin(12, Pin.OUT)echo_pin = Pin(20, Pin.IN)# 초음파 센서를 이용해 거리 측정def measure_distance(): # 트리거 핀을 통해 10us 동안 초음파 신호 발생 trigger_pin.low() time.sleep_us(2) trigger_pin.high() time.sleep_us(10) .. 더보기
라즈베리파이 피코 : 디지털 데이터 읽기 쓰기 - 터치센서, 푸시버튼, LED 1. 디지털 데이터 읽기(1) Touch.py : 터치센서- VCC : 3.3V- GND : GND- SIGNAL : 21번import machineimport utime# 21번 핀을 입력 모드로 설정signal_pin = machine.Pin(21, machine.Pin.IN)# 디지털 신호 읽기def read_digital_signal(): return signal_pin.value()# 신호를 5초마다 읽고 출력while True: signal_value = read_digital_signal() # 디지털 신호 읽기 print("Signal value:", signal_value) # 신호 값 출력 utime.sleep(0.1) # 0.1초 대기 (2) PushButt.. 더보기
라즈베리파이 피코 : 아날로그 데이터 읽기 쓰기 - 습도 센서 , 조이스틱, 서보모터 참고사이트 : https://github.com/mtinet/picoW GitHub - mtinet/picoWContribute to mtinet/picoW development by creating an account on GitHub.github.com 1. 아날로그 데이터 읽기(1) Analog1.py : 습도센서- VCC : 3.3V- GND : GND- S : 26번import machineimport utime analog_value = machine.ADC(26) while True: reading = analog_value.read_u16()/16 print("ADC: ", reading) utime.sleep(0.2) (2) Analog2.py : 조이스틱- VCC : .. 더보기
라즈베리파이 피코 시리얼통신, Mediapipe 활용 1. 시리얼통신 테스트- SerialTest.py - Thonny에서 라즈베리파이 피코를 연결한 후 라즈베리파이 피코에 SerialTest.py를 저장하고 실행함. from machine import Pinimport _threadled = Pin("LED", Pin.OUT)input_char = ''def input_thread(): global input_char while True: input_char = input()# 입력을 처리하는 스레드 시작_thread.start_new_thread(input_thread, ())print("Enter 'a' to turn ON the LED, 'b' to turn OFF the LED.")while True: if input.. 더보기
라즈베리파이 피코 웹캠 Webcam 활용 - openCV, Mediapipe 1. Vusual Studio Code 설치 2. Thonny에서 라이브러리 설치- 설치방법Thonny 실행"Tools(도구)" → "Manage packages(패키지 관리)" 클릭검색창에 opencv-python 입력 후 설치(Install) 버튼 클릭같은 방식으로 mediapipe 입력 후 설치(Install) 버튼 클릭설치 완료 후, 쉘(Shell)에서 아래 명령어 실행하여 설치 확인import cv2import mediapipe as mpprint(cv2.__version__) # OpenCV 버전 확인print(mp.__version__) # MediaPipe 버전 확인- 터미널에서 직접 설치할 경우Thonny의 Shell에서 아래 명령어를 직접 입력하여 설치할 수도 있습니다.pip in.. 더보기
라즈베리파이 피코란? - 마이크로파이썬 Thonny설치 라즈베리파이 피코(Raspberry Pi Pico)는 라즈베리파이 재단이 개발한 소형 마이크로컨트롤러 보드로, 주로 임베디드 시스템 및 IoT 프로젝트에 사용됩니다. 아래는 핵심 기능과 특징을 요약한 내용입니다: 🧩 핵심기능마이크로컨트롤러RP2040 (Raspberry Pi 자체 설계 듀얼코어 ARM Cortex-M0+ 프로세서, 최대 133MHz)메모리264KB SRAM, 2MB 플래시 메모리입출력(I/O)26개의 GPIO 핀 (디지털 입력/출력, 아날로그 입력, PWM 등)통신 인터페이스I2C, SPI, UART 지원 (각 2채널 이상)전원 공급1.8V ~ 5.5V (보통 USB 5V 사용), 저전력 소비프로그래밍 언어C/C++, MicroPython, CircuitPython크기 및 구조소형 보드.. 더보기

반응형