1 2 | sudo apt-get install python-dev sudo apt-get install python-rpi.gpio |
1 2 3 4 5 6 7 8 9 10 11 12 13 | # -*- coding: utf-8 -*- import RPi.GPIO as GPIO import time # BOARD编号方式,基于插座引脚编号 GPIO.setmode(GPIO.BOARD) # 输出模式 GPIO.setup(24, GPIO.OUT) while True: GPIO.output(24, GPIO.HIGH) time.sleep(1) GPIO.output(24, GPIO.LOW) time.sleep(1) |
1 | sudo python led.py |
1 2 3 4 5 6 7 8 | #如果之前没有安装过 git,执行下面的命令安装一下 sudo apt-get install git-core sudo apt-get update #下载 wiringPi git clone git://git.drogon.net/wiringPi #编译 wiringPi cd wiringPi ./build |
1 2 3 4 | #显示版本信息 gpio -v #显示GPIO信息 gpio readall |
1 2 3 4 5 6 7 8 9 10 11 | #include <wiringPi.h> int main(void) { wiringPiSetup(); pinMode (10, OUTPUT); for(;;) { digitalWrite(10, HIGH); delay (500); digitalWrite(10, LOW); delay (500); } } |
1 2 | gcc -Wall -o led led.c -lwiringPi sudo ./led |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |