Introduction to IoT by making and learning from zero knowledge Although it is Arduino, there is an explanation of breadboard and L Chika, and you can get the original at the time of 1500 yen sale.
Check the GPIO number on the board.
$ gpio readall
I get an error if the library is out of date
Oops - unable to determine board type... model: 17
cd /tmp
$ wget https://project-downloads.drogon.net/wiringpi-latest.deb
$ sudo dpkg -i wiringpi-latest.deb
again gpio readall
Physical = Serial number PIN 0v = GND Will be displayed in the terminal
3.3V current is flowing to each PIN on the left side 5V current is flowing to each PIN on the right side
0v becomes GND. GND is minus GND is explained in detail in the Umedy video. We encourage you to systematically learn about GPI with Umedy videos.
GPIO.BOARD: Physical pin number (serial number) GPIO.BCM: Role pin number (named by broadcom)
Since the GPIO number may differ depending on the model, it seems better to use GPIO.BOARD (serial number) specified by the PIN number.
l.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
#RPi.Import GPIO module
from time import sleep
#GPIO.setmode(GPIO.BCM)
#GPIO.setmode(GPIO.BOARD)
#Use serial numbers
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT)
try:
while True:
GPIO.output(7, GPIO.HIGH)
sleep(0.5)
GPIO.output(7, GPIO.LOW)
sleep(0.5)
except KeyboardInterrupt:
#GPIO setting clear
GPIO.cleanup()
$ python l.pay
#### Overall flow
Connect the PIN plus (red) to the PIN minus (black) (GND) through the breadboard.
It is necessary to add a resistor to adjust so that too much current does not flow through the diode.
[Purchase parts in bulk (with sample file CD)](https://www.amazon.co.jp/gp/product/B01M6ZFNSS/)
Eventually I'll convert these to C # and use them with Microsoft's GPIO library.
Postscript Sample File URL There were sample files and videos on the OSOYOO site
You can purchase sensor parts in bulk on Amazon You should learn GPIO systematically. Umedy had a Raspbery video Buying a cheap Amazon tester and checking if the current is flowing will speed up your understanding Purchase parts together There is a sample project file in the set, and it seems that self-propelled learning is possible
Microsoft has released a GPIO library, so let's try it out.
Microsoft GPIO Library MONO GPIO Library
Recommended Posts