Raspberry Pi 2/3 GPIO - LED, Button

Slides:



Advertisements
Similar presentations
Raspberry Pi The singing jelly baby.
Advertisements

V Avon High School Tech Club Agenda Old Business –Executive Committee –LCCUG meeting volunteer(s) –Reward Points Program New Business –Weekly.
Embedded Programming and Robotics
SINGLE BOARD COMPUTERS -KEVIN JOSE. WHY DO WE USE THEM? Good performance at low price GPIO capability to interact with the outside world Small form factor,
RASPBERRY PI IMPLEMENTING BINARY COUNTING Marlon Myers Computer Hardware Systems: EMT 2370 Instructor: Prof. Carranza.
NPN Foundations of Technology NPN © 2013 International Technology and Engineering Educators Association, STEM  Center for Teaching and Learning™ Foundations.
Detection Circuit ENGR Lecture. Learning Objectives of Lab  Students will learn about –  Electronic circuit components  Building the binary.
How an NPN Transistor Works
CSCI1600: Embedded and Real Time Software Lecture 4: Introduction to the Arduino Steven Reiss, Fall 2015.
Braille Printer An-Najah National University Faculty of Engineering Braille Printer Prepared by : Rbee waheeb Supervisor: Dr. Nidal Farahat May
DPNM Lab., POSTECH 1/8 CS490K - Internet of Things (IoT) Jonghwan Hyun DPNM Lab. Department of Computer Science and Engineering, POSTECH
Welcome to Week 4 at the Summer Computer Club Raspberry Pi (contd)
Hacking Minecraft on the Raspberry Pi using Python
Python for intel Galileo GEN2 TYWu. Software Download/Setup "Bigger" Linux Image Download the Arduino IDE for Galileo –
Bonus EV3 Programming Lessons By Droids Robotics LEGO MINDSTORMS and Raspberry Pi IR Light controller.
Bonus EV3 Programming Lessons LEGO MINDSTORMS ev3dev and Raspberry Pi IR Light controller.
Hit-and-Run Detection Camera Group #25: Nick Prozorovsky, Eric Stiles, and Wilson Wang.
Embedded Software Design Week V Advanced Python 7- segment Display.
Raspberry Pi Project Control Your Home Lights with a Raspberry Pi.
Raspberry Pi project - 라즈베리파이로 핑퐁게임하기 신동윤 박지환.
Raspberry PI 2 Installation & Demo App By Wayne Keadle.
ECE ILLINOIS. ECE 445 Spring 2016 Smart closet Group 24 Luchuan Zhang Yiwei Li.
Embedded Software Design Week III Processor Basics Raspberry Pi -> Blinking LEDs & pushing buttons.
Raspberry pi GPIO Basic’s Lecturer: Reza Arjmandi Summer 2016 Preface: This chapter contains some basic recipes for setting up and using the Raspberry.
What is your age in binary? I am is a decimal number Use this table to convert a decimal number into a binary number. To make 12 I need to add 8.
Zilogic Systems 1 Device Interfacing with Python and ZIO Zilogic Systems.
Jeremy Sandoval University of Washington May 14, 2013
Python with Raspberry PI Kit
Class 1: Building a Raspberry Pi LED Flasher
RASPBERRY PI WORKSHOP.
Logic Gates Binary Day 3 PEOPLE 2016.
Light Dependent Resistor
Internet of Things (internet of everything?)
Device Interfacing with Python and ZIO
Chapter A - The Raspberry Pi Computer
Running your own web server
1 Button 2 Buttons Light Emitting Diodes LED and Buttons
The Raspberry Pi Initiative
UltraSonic Sensor VCC is the pin that powers the device, connect to 5V. Trigger is the pin that sends out the burst. Echo is the pin that outputs when.
WORKSHOP LED CONTROL.
RASPBERRY PI WORKSHOP.
Building Raspberry Pi Controllers with Python
Session 3 DIY Moderate Project
Lighting LEDs with a RASPBERRY PI
Raspberry Pi.
Hacking Minecraft on the Raspberry Pi using Python
BBC Microbit.
सोलर पॅनेलचा उपयोग करुन रीचर्जेबल टॉर्च बनवणे.
Internet-of-Things (IoT)
Building Raspberry Pi Controllers with Python
Raspberry Pi: External Inputs & Outputs
Traffic light programming challenges
Raspberry Pi with Pibrella
Motion Controlled Servo Motor
Hacking Minecraft on the Raspberry Pi using Python
Reading / Writing analogue devices LED + Game-controller
RPi 2/3, I2C, Analog Sensor
RPi 2/3 GPIO + Web(Flask)
How an NPN Transistor Works
Light Dependent Resistor
EECE6017 Lab 5 My First HPS with GPIO
UNIT 9 Relays.
Passive Infrared Sensor
Python with Raspberry PI Kit
Controlling LED with PWM
UNIT 9 Relays.
Objective of the lesson
Chapter 7 IoT Physical Devices and Endpoints
IoT System Development with Raspberry Pi and Django
Robot and Crickit HAT © Copyright 2019 by Dr. Elizabeth I. Horvath and Dr. Eva A. Horvath 1.
Presentation transcript:

Raspberry Pi 2/3 GPIO - LED, Button jyheo@hansung.ac.kr

Raspberry Pi 2/3 GPIO GPIO: General Purpose Input/Output

RPi2 GPIO - LED Source: https://www.raspberrypi.org/documentation/usage/gpio/

RPi2 GPIO - LED Source: https://www.raspberrypi.org/documentation/usage/gpio/

RPi2 + Breadboard

RPi2 GPIO - LED Be Carefull while Wiring! GND GPIO24 LED: longer leg must be connected to + (GPIO24).

RPi2 GPIO - LED $ nano gpio-led.py $ python3 gpio-led.py import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) led=24 # GPIO channel number GPIO.setup(led, GPIO.OUT) GPIO.output(led, 1) time.sleep(2) GPIO.output(led, 0) $ nano gpio-led.py $ python3 gpio-led.py https://github.com/jyheo/rpi2/blob/master/gpio-led.py

RPi2 GPIO - Button Be Carefull while Wiring! GPIO21 Source: http://razzpisampler.oreilly.com/ch07.html

RPi2 GPIO - Button $ nano gpio_button.py import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) button = 21 GPIO.setup(button, GPIO.IN, GPIO.PUD_UP) while True: if GPIO.input(button) == False: print("Button pressed.") break $ nano gpio_button.py $ python3 gpio_button.py Button pressed https://github.com/jyheo/rpi2/blob/master/gpio_button.py

RPi2 GPIO - Button, Callback example import RPi.GPIO as GPIO import time def button_pressed(channel): print("Button pressed.") GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) button = 21 GPIO.setup(button, GPIO.IN, GPIO.PUD_UP) GPIO.add_event_detect(button, GPIO.RISING, bouncetime=200) # rising edge detection GPIO.add_event_callback(button, button_pressed) # callback while True: continue https://github.com/jyheo/rpi2/blob/master/gpio_button2.py

Reference GPIO with Python GPIO with C Advanced https://www.raspberrypi.org/documentation/usage/gpio/ http://sourceforge.net/p/raspberry-gpio-python/wiki/BasicUsage/ GPIO with C http://blog.naver.com/elepartsblog/220284169123 http://blog.naver.com/elepartsblog/220285369508 Advanced http://wiringpi.com/ http://raspberrypi.znix.com/hipidocs/topic_gpiodev.htm (GPIO driver)

Exercise 2 buttons, 1 LED When one button is pressed, turn LED on When the other button is pressed, turn LED off