Raspberry Pi 3 GPIO Project For Beginners Part 2
Автор: Smart Spate
Загружено: 2017-08-29
Просмотров: 542
Описание:
In this Part 2 video tutorial, we continue to show you how to use GPIO Connectors to light up some LED and make some kind of LED Stop light. This type of project requires more than a basic knowledge of Python and Linux but we will try to explain so that even beginners could understand it.
What you will need for this Project:
1) Raspberry Pi 3 B+ Model - https://www.google.ca/aclk?sa=L&ai=DC...
2) Ribbon Cable for Raspberry Pi - https://www.amazon.ca/s/?ie=UTF8&keyw...
3) T-Cobbler Plus GPIO Breakout GPIO - https://www.google.ca/url?sa=t&rct=j&...
4) Full-Size BreadBoard ( Would be the best for this project) - https://www.google.ca/url?sa=t&rct=j&...
5) A few of Male Connection Wire Jumpers - https://www.google.ca/url?sa=t&rct=j&...
6) A few of LED 5mm Light Bulb (Any color, but in our case, we will be using the red one) -https://www.google.ca/aclk?sa=L&ai=DC...
7) Resistors 100 Ohm or higher ( Minimum 60 Ohm so that your Bulb is not fried up ) - https://www.google.ca/aclk?sa=L&ai=DC...
8) Power Adapter for your Raspberry Pi - https://www.google.ca/aclk?sa=L&ai=DC...
9) Ethernet Cable CAT 5e, 6 if you don't want to use Wireless Connection - https://www.google.ca/aclk?sa=L&ai=DC...
In case if you don't know how to connect to your Raspberry Pi and use a Putty Software which allows you connect remotely then you have to have all of the listed below to make it work:
1) Monitor;
2) HDMI Cable;
3) Keyboard;
4) Mouse;
Script:
Here are the stop light commands...
import time
GPIO.setup(17, GPIO.OUT)
GPIO.setup(22, GPIO.OUT)
while True :
GPIO.output(22, True)
time.sleep(5)
GPIO.output(22, False)
GPIO.output(17, True)
time.sleep(2)
GPIO.output(17, False)
GPIO.output(4, True)
time.sleep(5)
GPIO.output(4, False)
CTRL-C to stop the while loop
Here is what should be in the rapidlink.py file...
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)
GPIO.setup(17, GPIO.OUT)
GPIO.setup(22, GPIO.OUT)
import time
while True :
GPIO.output(4, True)
time.sleep(.1)
GPIO.output(4, False)
GPIO.output(17, True)
time.sleep(.1)
GPIO.output(17, False)
GPIO.output(22, True)
time.sleep(.1)
GPIO.output(22, False)
GPIO.output(17, True)
time.sleep(.1)
GPIO.output(17, False)
CTRL-C to stop the script
Here is what should be in the ledoff.py file...
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)
GPIO.setup(17, GPIO.OUT)
GPIO.setup(22, GPIO.OUT)
GPIO.output(4, False)
GPIO.output(17, False)
GPIO.output(22, False)
Music by:
Eternal Hope by Kevin MacLeod is licensed under a Creative Commons Attribution License (https://creativecommons.org/licenses/...)
Source: http://incompetech.com/music/royalty-...
Artist: http://incompetech.com/
You can Fins Us at:
Our Official Web Page: http://www.smartspate.com
Our Twitter Page: / smartspate
Our Facebook Page: / itblogforum
Our Facebook IT Group: / 15062
Повторяем попытку...

Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: