标签:版本 class 安装包 wrap read ons war ber Oz
树莓派各版本硬件原理图:https://www.raspberrypi.org/documentation/hardware/raspberrypi/README.md
配置
两个5V,3.3V输出端口
IO输入输出电压0-3.3V
支持输出PWM
两路SPI总线
两路IIC总线
一路串口
GPIO Zero库:https://gpiozero.readthedocs.io/en/stable/
安装GPIO Zero库步骤
更新系统包 sudo apt update
安装包
python3: sudo apt install python3-gpiozero
python2: sudo apt install python-gpiozero
LED例子
from gpiozero import Button
from time import sleep
button = Button(2)
?
while True:
if button.is_pressed:
print("Pressed")
else:
print("Released")
sleep(1)
Button
from gpiozero import Button
from time import sleep
?
button = Button(2)
?
while True:
if button.is_pressed:
print("Pressed")
else:
print("Released")
sleep(1)
?
标签:版本 class 安装包 wrap read ons war ber Oz
原文地址:https://www.cnblogs.com/BlogsOfLei/p/9206162.html