KEMBAR78
Raspberry pi tutorial #1 | PPTX
1
Raspberry Pi Tutorial #1
- Blink the LED -
Dong Ho Son
POSTECH
Pohang, Korea
donghoson@postech.ac.kr
2
Turning on the LED - Overview
 Necessary Components
• Raspberry Pi
• 1 x Breadboard
• 1 x red LED
• 1 x Resistor
• Jumper cables
Anode
Cathode
Power rails
Terminal strips
3
Turning on the LED – Circuit Configuration
 Ground pin  the cathode of the LED
 The anode of the LED  a ballast
resistor
 The ballast resistor  the pin GPIO 17
Ground
GPIO 17
AnodeCathode
4
Turning on the LED - Python
 Import RPi.GPIO as GPIO
• Import Python GPIO module
 GPIO.output(pin, GPIO.HIGH)
• Turn on the LED
 time.sleep(1)
• Delay for 1 second
 GPIO.output(pin, GPIO.LOW)
• Turn off the LED
 GPIO.setmode(GPIO.BCM)
 GPIO.setup(17, GPIO.OUT)
• Select GPIO #17 as output pin
5
Turning on the LED – Program Writing & Execution
 Python Programming using Text editors
• Desktop Graphical Editors – LEAFPAD, IDLE, GVIM
• Command-Line Editors – NANO, VI, VIM, EMACS
 Python Programming Interpreter
• Built-in Interpreter provided in Raspbian
• Command line execution: “$ python program.name”
6
Turning on the LED - Result
 The LED is blinked!
Ground
GPIO 17

Raspberry pi tutorial #1

  • 1.
    1 Raspberry Pi Tutorial#1 - Blink the LED - Dong Ho Son POSTECH Pohang, Korea donghoson@postech.ac.kr
  • 2.
    2 Turning on theLED - Overview  Necessary Components • Raspberry Pi • 1 x Breadboard • 1 x red LED • 1 x Resistor • Jumper cables Anode Cathode Power rails Terminal strips
  • 3.
    3 Turning on theLED – Circuit Configuration  Ground pin  the cathode of the LED  The anode of the LED  a ballast resistor  The ballast resistor  the pin GPIO 17 Ground GPIO 17 AnodeCathode
  • 4.
    4 Turning on theLED - Python  Import RPi.GPIO as GPIO • Import Python GPIO module  GPIO.output(pin, GPIO.HIGH) • Turn on the LED  time.sleep(1) • Delay for 1 second  GPIO.output(pin, GPIO.LOW) • Turn off the LED  GPIO.setmode(GPIO.BCM)  GPIO.setup(17, GPIO.OUT) • Select GPIO #17 as output pin
  • 5.
    5 Turning on theLED – Program Writing & Execution  Python Programming using Text editors • Desktop Graphical Editors – LEAFPAD, IDLE, GVIM • Command-Line Editors – NANO, VI, VIM, EMACS  Python Programming Interpreter • Built-in Interpreter provided in Raspbian • Command line execution: “$ python program.name”
  • 6.
    6 Turning on theLED - Result  The LED is blinked! Ground GPIO 17