Raspberry Pi ( python )

Ch01. 라즈베리파이 시작하기

hojomu 2023. 2. 27. 15:14

1 _ SD Card Format

SD Card Formatter를 다운받아서 작업을 진행하기 전 SD Card를 포맷할 수 있습니다.

링크 : http://sd-card-formatter.kr.uptodown.com/windows/download 

 

SD Card Formatter 5.0.2을 위한 Windows을 다운로드하세요 | Uptodown.com

탄탄하고 용도가 다양하며, 맞춤 설정도 가능한 브라우저 컴퓨터 작업 손쉽게 자동화하기 DOS 를 위해 부팅가능한 USB를 만드세요. 사용중이거나, 보호되고 있거나 금지된 파일들을 삭제하세요

sd-card-formatter.kr.uptodown.com

Volume label에 raspberry 라고 작성한 뒤, Overwrite format을 체크한 후 Format을 진행한다.

 


2 _ Raspbian (라즈비안) 다운로드 후 SD 카드 세팅

 : 라즈베리 파이의 공식 운영체제인 라즈비안을 SD 카드에 세팅해야한다.

링크 : https://www.raspberrypi.org 

 

Teach, learn, and make with the Raspberry Pi Foundation

We are a charity with the mission to enable young people to realise their full potential through the power of computing and digital technologies.

www.raspberrypi.org


3 _ 라즈베리파이, 브레드보드 정상 확인

 :  라즈베리 파이로 LED 작동시키기

 

1. 파일 매니저를 실행시킨다. ( 메뉴 - 보조프로그램 - File Manager 또는 파일 매니저 아이콘 클릭 )

2. wdbapps/ch01 폴더 생성

3. Geany 에디터 실행 ( 라즈베리파이에서 python을 실행할 수 있게 도와준다 )

4. py 파일 생성

파일명 : led_ex01.py

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BOARD)

LED = 8

GPIO.setup(LED, GPIO.OUT, initial=GPIO.LOW)

try:
	while 1:
    		GPIO.output(LED, GPIO.HIGH)
            time.sleep(0.5)
            
    		GPIO.output(LED, GPIO.LOW)
            time.sleep(0.5)
except KeyboardInterrupt:
	pass
    
GPIO.cleanup()