Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Orange pie Orange Pi 4 development board how to use python to control GPIO under Ubuntu system

Shulou Source: shulou.com Published: 2022-06-02 00:05:56 09月27日 Update

This article is about how the orange pie Orange Pi 4 development board uses python to control GPIO under the Ubuntu system. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Orange pie Orange Pi 4 development board is equipped with Ruixin Micro Rockchip RK3399's 6-core ARM ®64-bit processor, with dual-channel 4GB LPDDR4 memory, on-board 16GB EMMC flash storage, support for Android 8.1, Ubuntu 16.04, Debian 9 and other operating systems, support for dual camera input, dual mipi lcd interface, support for two video output at the same time. In addition to MIPI-CSI dual camera interface, HDMI2.0 video output interface, microphone port, 3.5mm and HDMI2.0 audio output port, gigabit Ethernet port, USB3.0,USB2.0,Type-C and other standard interfaces, there are debug serial port, 24pin PCIE interface, 40pin raspberry pie compatible extension port.

How to use Python to control GPIO in Ubuntu system.

1. Download OPi.GPIO

Git clone https://github.com/baiywt/OPi.GPIO.git

2. Installation

Apt install python3-pip

Cd OPi.GPIO

Python3 setup.py install

3. Testing

Create a new file test_gpio.py

Import time

Import sys

Import OPi.GPIO as GPIO

Import orangepi.pi4

BOARD = orangepi.pi4.BOARD

GPIO.setmode (BOARD)

Pin=int (sys.argv [1])

GPIO.setup (pin, GPIO.OUT)

While True:

GPIO.output (pin, GPIO.HIGH)

Time.sleep (1)

GPIO.output (pin, GPIO.LOW)

Time.sleep (1)

Cd..

Python3 test_gpio.py 16 / / controls the physical pin to flip the level once in 16 1 seconds

Thank you for reading! On the "orange pie Orange Pi 4 development board in the Ubuntu system how to use python to control GPIO" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Tags: Interface system control orange development support output content at the same time camera more article video camera good practical operating system serial port memory processor Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Redmi MySQL Apple Shulou Information