http://www.cnblogs.com/qtsharp/archive/2013/02/28/2936800.html

树莓派RaspberryPi的RPi.GPIO使用指南

 

Python操作树莓派GPIO的必要准备

sudo apt-get install python-setuptools
sudo easy_install -U distribute
sudo apt-get install python-dev
sudo easy_install RPi.GPIO

树莓派GPIO定义图

PRi.GPIO的使用示例

1
2
3
4
5
6
7
8
9
10
11
12
13
import RPi.GPIO
import time
RPi.GPIO.setmode(RPi.GPIO.BOARD)  #GPIO.BOARD GPIO.BCM分别表示IO口的标号方式
RPi.GPIO.setup(12,RPi.GPIO.OUT)
RPi.GPIO.setup(11,RPi.GPIO.IN)
RPi.GPIO.output(12,GPIO.HIGH)
 
while True:
    if RPi.GPIO.input(11):
        RPi.GPIO.output(12,GPIO.LOW)
    else:
        RPi.GPIO.output(12,GPIO.HIGH)
    time.sleep(1)

【Raspberry pi】GPIO使用指南的更多相关文章

  1. Raspberry Pi GPIO Protection

    After damaging the GPIO port on our raspberry pi while designing a new solar monitoring system we de ...

  2. Raspberry Pi & GPIO

    Raspberry Pi & GPIO pinout === pin out / p in out pi@raspberrypi:~ $ pinout ,------------------- ...

  3. Pi# - Raspberry Pi GPIO Library for .NET

    Project Description Pi# (pronounced “Pi Sharp”) is a library to expose the GPIO functionality of the ...

  4. (0)开始 Raspberry Pi 项目前需要知道的 10 件事

    https://www.digikey.cn/zh/articles/techzone/2017/feb/10-things-to-know-before-starting-a-raspberry-p ...

  5. (RaspBerry Pi) Python GPIO 基本操作

    目前打算由潛入深慢慢學習RaspBerry Pi, 所以先由最容易下手的Python進入樹莓派的世界 首先要使用 GPIO 需要利用RPI.GPIO package想當然爾必須先安裝 所以先執行下列命 ...

  6. 树莓派 Raspberry PI之GPIO

    树莓派 Raspberry PI之GPIO 树莓派各版本硬件原理图:https://www.raspberrypi.org/documentation/hardware/raspberrypi/REA ...

  7. 树莓派 Raspberry Pi 与 micro:bit起手式

    本文将学习如何在Raspberry Pi上安装MicroPython编辑器mu,并将MicroPython中编写的程序从您的Raspberry Pi推送到micro:bit. 您需要: 硬件, 带有S ...

  8. 【树莓派】【转载】Raspberry Pi (树莓派)折腾记

    在网上看到一篇对树莓派折腾记录比较详细的文章,时间比较早,但是有些东西没变. 对于新手而言,还是有点参考价值.文章参见:http://skypegnu1.blog.51cto.com/8991766/ ...

  9. 【Raspberry Pi】新入手的Raspberry Pi3拼装日志

    一.概述 2016年暑假某宝入手Raspberry Pi 3,装机清单: 树莓派主板 亚克力外壳 小风扇 散热片 30G SD card 螺丝若干颗 因机型问题,可能与你的机器有微小差异 二.装机过程 ...

随机推荐

  1. 应用LR监控Apache性能

    1)对Apache服务器中的http.conf进行如下配置修改Apache中Httpd.conf文件,添加如下代码(该文件中都有,只要取消注释就好了)<Location /server-stat ...

  2. BEGINNING SHAREPOINT&#174; 2013 DEVELOPMENT 第2章节--SharePoint 2013 App 模型概览 总结

    BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第2章节--SharePoint 2013 App 模型概览 总结         SharePoint Apps这三个新 ...

  3. 【微信小程序】微信小程序wx.previewImage预览图片

    一.小知识 二.例子,配合轮播图使用效果更佳!(如图1) 1.wxml <scroll-view scroll-y="true"> <swiper catchta ...

  4. MQTT Client软件-MQTTBox

    最近发现了一个连接mqtt broker的软件:MQTTBox.GitHub地址:https://github.com/workswithweb/MQTTBox 官网网站的介绍为:使用MQTTBox增 ...

  5. Android studio 使用心得(一)—android studio快速掌握快捷键

    大家都是从eclipse转过来了,所以早就熟悉了eclipse那一套快捷键. File—>settings—>keymap–>选择eclipse就搞定 话是这么说,但是自动化提示的变 ...

  6. 简单的刚開始学习的人配置Android SDK+ADT+Eclipse

    1.下载JDK.Android SDK和Eclipse(Eclipse 版本号最好新一些) 注意:下载的SDK最好和后面的ADT配套,否则Eclipse可能会报错. 如:SDK 21.0.1 相应 A ...

  7. PHP中获取当前页面的完整URL & php $_SERVER中的SERVER_NAME 和HTTP_HOST的区别

    #测试网址:     http://localhost/blog/testurl.php?id=5 //获取域名或主机地址 echo $_SERVER['HTTP_HOST']."<b ...

  8. UNIX网络编程卷1 时间获取程序client UDP 协议无关

    本文为senlie原创.转载请保留此地址:http://blog.csdn.net/zhengsenlie /** * UDP.协议无关,调用 getaddrinfo 和 udp_client **/ ...

  9. c语言循环单链表

    /************************************************************************* > File Name: singleLin ...

  10. C#遍历计算机上所有的文件

    class Program { static List<string> allFileName=new List<string>(); static void Main(str ...