RaspberryPi L Chika with Python and C #

L Chika in Python

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.

Display a list of gpio pins

Check the GPIO number on the board.

$ gpio readall
wiringpi library If you get an error if it is old

I get an error if the library is out of date

Oops - unable to determine board type... model: 17

Update wiring pi

cd /tmp
$ wget https://project-downloads.drogon.net/wiringpi-latest.deb
$ sudo dpkg -i wiringpi-latest.deb

again gpio readall

Display of gpio PIN number

Physical = Serial number PIN 0v = GND Will be displayed in the terminal スクリーンショット 2020-05-28 15.57.12.png

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)

GPIO numbers are different for each model, so use PIN serial number (BOARD)

Since the GPIO number may differ depending on the model, it seems better to use GPIO.BOARD (serial number) specified by the PIN number.

スクリーンショット 2020-05-28 15.57.12.png

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
スクリーンショット 2020-05-29 17.26.23.png #### 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. スクリーンショット 2020-05-28 15.57.12.png [Purchase parts in bulk (with sample file CD)](https://www.amazon.co.jp/gp/product/B01M6ZFNSS/) スクリーンショット 2020-05-29 18.02.23.png 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

point

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

Next time in C # L Chika

Microsoft has released a GPIO library, so let's try it out.

Microsoft GPIO Library MONO GPIO Library

L Chika in C #

Recommended Posts

RaspberryPi L Chika with Python and C #
[C, C ++, Python, JavaScript] L Chika with Edison
Use raspberryPi and Julius (speech recognition). ④ L Chika
Programming with Python and Tkinter
Remote L Chika with pigpio
Python and hardware-Using RS232C with Python-
ABC163 C problem with python3
python with pyenv and venv
ABC188 C problem with python3
ABC187 C problem with python
Works with Python and R
Solving with Ruby and Python AtCoder ARC 059 C Least Squares
Solving with Ruby and Python AtCoder ABC011 C Dynamic programming
Solving with Ruby and Python AtCoder ARC067 C Prime Factorization
Communicate with FX-5204PS with Python and PyUSB
Shining life with Python and OpenCV
Solve ABC163 A ~ C with Python
Robot running with Arduino and python
Call C from Python with DragonFFI
Install Python 2.7.9 and Python 3.4.x with pip.
Create Awaitable with Python / C API
Neural network with OpenCV 3 and Python 3
Scraping with Node, Ruby and Python
Scraping with Python, Selenium and Chromedriver
Scraping with Python and Beautiful Soup
JSON encoding and decoding with python
Hadoop introduction and MapReduce with Python
[GUI with Python] PyQt5-Drag and drop-
Try L Chika with raspberry pi
I played with PyQt5 and Python3
Solved AtCoder ABC 114 C-755 with Python3
Solve ABC162 A ~ C with Python
Solve ABC167 A ~ C with Python
Solve ABC158 A ~ C with Python
Reading and writing CSV with Python
Multiple integrals with Python and Sympy
Coexistence of Python2 and 3 with CircleCI (1.0)
Easy modeling with Blender and Python
Sugoroku game and addition game with python
L Chika on Raspberry Pi C #
FM modulation and demodulation with Python
Solving with Ruby, Perl, Java, and Python AtCoder ABC 065 C factorial
Create a C ++ and Python execution environment with WSL2 + Docker + VSCode
Communicate between Elixir and Python with gRPC
Data pipeline construction with Python and Luigi
Calculate and display standard weight with python
Monitor Mojo outages with Python and Skype
FM modulation and demodulation with Python Part 3
Python installation and package management with pip
Using Python and MeCab with Azure Databricks
Implement FIR filters in Python and C
POST variously with Python and receive with Flask
Capturing images with Pupil, python and OpenCV
Fractal to make and play with Python
A memo with Python2.7 and Python3 on CentOS
[C] [python] Read with AquesTalk on Linux
Use PIL and Pillow with Cygwin Python
Write O_SYNC file in C and Python
Create and decrypt Caesar cipher with python
CentOS 6.4 with Python 2.7.3 with Apache with mod_wsgi and Django
Reading and writing JSON files with Python