Let's operate GPIO of Raspberry Pi with Python CGI

Premise

--CGI can be executed with python -m http.server 8080 --cgi --Apache 2 installed

Apache2 settings

-Please refer to Past Articles to set.

Settings for using GPIO

-- sudo usermod -aG gpio www-data

Commentary

If I execute it without entering the previous command, no error is displayed, but there is no response on the Raspberry Pi. So check the error log. When I check it as less /var/log/apache2/error.log, I get the errorRuntimeError: No access to /dev/mem. Try running as root!. Since it says "Try running it as a root", I gave it root privileges in the previous settings. www-data is the Apache2 username.

Recommended Posts

Let's operate GPIO of Raspberry Pi with Python CGI
Get CPU information of Raspberry Pi with Python
Measure CPU temperature of Raspberry Pi with Python
Use vl53l0x with Raspberry Pi (python)
I tried running Movidius NCS with python of Raspberry Pi3
Operate an oscilloscope with a Raspberry Pi
Working with GPS on Raspberry Pi 3 Python
CSV output of pulse data with Raspberry Pi (confirm analog input with python)
I tried L-Chika with Raspberry Pi 4 (Python edition)
Enjoy electronic work with GPIO on Raspberry Pi
CSV output of pulse data with Raspberry Pi (CSV output)
One-liner that outputs 10000 digits of pi with Python
Connect to MySQL with Python on Raspberry Pi
GPS tracking with Raspberry Pi 4B + BU-353S4 (Python)
GPGPU with Raspberry Pi
Operate Kinesis with Python
Let's do Raspberry Pi?
Operate Blender with Python
DigitalSignage with Raspberry Pi
Operate Excel with Python (1)
Operate Excel with Python (2)
Periodically notify the processing status of Raspberry Pi with python → Google Spreadsheet → LINE
Log the value of SwitchBot thermo-hygrometer with Raspberry Pi
Ubuntu 20.04 on raspberry pi 4 with OpenCV and use with python
Raspberry Pi with Elixir, which is cooler than Python
Operate Excel with Python openpyxl
Mutter plants with Raspberry Pi
Let's run Excel with Python
[Note] Operate MongoDB with Python
Raspberry Pi + Python + OpenGL memo
Let's write python with cinema4d.
raspberry pi 1 model b, python
[Python] [SQLite3] Operate SQLite with Python (Basic)
Let's build git-cat with Python
Let's find pi in Python
Update Python for Raspberry Pi to 3.7 or later with pyenv
Python beginner opens and closes interlocking camera with Raspberry Pi
Create an LCD (16x2) game with Raspberry Pi and Python
Production of temperature control system with Raspberry Pi and ESP32 (1)
Let's touch the API of Netatmo Weather Station with Python. #Python #Netatmo
Run BNO055 python sample code with I2C (Raspberry Pi 3B)
SSD 1306 OLED can be used with Raspberry Pi + python (Note)
getrpimodel: Recognize Raspberry Pi model (A, B, B +, B2, B3, etc) with python
Connect Raspberry Pi to Alibaba Cloud IoT Platform with Python
[Raspberry Pi] Scraping of web pages that cannot be obtained with python requests + Beautiful Soup
[Raspberry Pi] Stepping motor control with Raspberry Pi
Getting Started with Heroku-Viewing Hello World in Python Django with Raspberry PI 3
Control the motor with a motor driver using python on Raspberry Pi 3!
Operate a receipt printer with python
Let's access your Raspberry Pi from outside your home with VPN (WireGuard)
Servo motor control with Raspberry Pi
March 14th is Pi Day. The story of calculating pi with python
I tried to automate the watering of the planter with Raspberry Pi
Let's make a GUI with python.
Try to operate Facebook with Python
Let's make a cycle computer with Raspberry Pi Zero (W, WH)
Serial communication with Raspberry Pi + PySerial
Notify LINE of body temperature from BLE thermometer with Raspberry Pi # 1
OS setup with Raspberry Pi Imager
Getting Started with Python Basics of Python
Let's play with Excel with Python [Beginner]