728x90
반응형
맨 위로 올라가기
General Purpose Input Output(PIO)

 

- 사용자가 configuration  할 수 있는 pin

# First, update your repositories list:
sudo apt upadate

 

# Then install the package for Python3:

sudo apt install python3-gpiozero

--
ubuntu@ubuntu:~/test$ sudo apt install python3-gpiozero
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  python3-pigpio
The following NEW packages will be installed:
  python3-gpiozero
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 71.8 kB of archives.
After this operation, 444 kB of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 python3-gpiozero arm64 1.4.1-1.2 [71.8 kB]
Fetched 71.8 kB in 2s (39.5 kB/s)
Selecting previously unselected package python3-gpiozero.
(Reading database ... 178649 files and directories currently installed.)
Preparing to unpack .../python3-gpiozero_1.4.1-1.2_arm64.deb ...
Unpacking python3-gpiozero (1.4.1-1.2) ...
Setting up python3-gpiozero (1.4.1-1.2) ...

 

$ pinout

 

Used a 330 ohm resistor.

#!/usr/bin/env python3

#Basic GPIO example
#Author: mnku

from gpiozero import LED
from time import sleep

led = LED(23)

#while True:
#    led.on()
#    sleep(1)
#    led.off()
#    sleep(1)

try:
    while True:
        led.on()
        sleep(1)
        led.off()
        sleep(1)

except KeyboardInterrupt:
    led.off()

 


 

728x90
반응형

+ Recent posts