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. 移动端(阿里rem)布局

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. Android中Native和H5交互

    1.概述 时至今日,H5的跨平台性越发凸显优势,一套代码适配android.ios,既能减少开发成本,又便于更新与维护.但是native的性能体验也确实更佳,尤其体现在复杂界面和频繁变化的界面上.事实 ...

  3. vs2005下面编译自己的luars232.dll

    vc6在win7下用不了,大家建议使用vs2005...所以就装了,但是还是提示有不兼容,不过是可以用的.先凑合用,装了个2012,庞然大物!而且折腾了半天不知所云.先这样吧. 简单记录操作过程,参考 ...

  4. lodash获取数组或对象的值 at

    <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...

  5. 一个漂亮而强大的RecyclerView

    代码地址如下:http://www.demodashi.com/demo/13470.html 简介 主要提供了简单易用强大的RecyclerView库,包括自定义刷新加载效果.极简通用的万能适配器A ...

  6. ubuntu安装Skype 4.3

    Install Skype 4.3 Step 1: Remove previous version sudo apt-get remove skype skype-bin:i386 skype:i38 ...

  7. SQL中intersect、union、minus和except 运算符

    1.intersect运算符intersect运算符通过只包括 TABLE1 和 TABLE2 中都有的行并消除所有重复行而派生出一个结果表.当 ALL 随 INTERSECT 一起使用时 (inte ...

  8. C++ opencv高速样例学习——读图显示

    1.关键函数 1. 读入图片 imread(图片或位置,显示格式)默觉得:IMREAD_COLOR 显示格式: IMREAD_UNCHANGED =-1    // 8bit, color or no ...

  9. CodeSmith单表生成实体模板与生成多表实体模板

    生成单实体模板: <%@ Template Language="C#" TargetLanguage="C#" %> <%@ Assembly ...

  10. Codeforces Round #265 (Div. 2) B. Inbox (100500)

    Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others ...