关于RPi.GPIO、BCM2835 c library、WiringPi、Gertboard
1.RPi.GPIO//RPi.GPIO-0.5.5.tar.gz
开发者:python官网:https://www.python.org/
官网:https://pypi.python.org/pypi/RPi.GPIO
RPi.GPIO安装
- sudo aptitude install python-dev
- # 下载
- $ wget https://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.5.tar.gz
- # 解压缩
- $ tar xvzf RPi.GPIO-0.5.3a.tar.gz
- # 进入解压之后的目录
- $ cd RPi.GPIO-0.5.3a
- # 启动安装
- $ sudo python setup.py install
python官网简介:Python Docs PyPI
python 文档 Python Package Index=python软件包目录
点开PyPI,然后再搜索框内搜索RPi.GPIO-0.5.5.tar.gz
2.BCM2835 c library
官网:http://www.airspayce.com/mikem/bcm2835/ //看看最新i2c实例
安装:
- # 下载
- $ wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.36.tar.gz
- # 解压缩
- $ tar xvzf bcm2835-1.35.tar.gz
- # 进入解压之后的目录
- $ cd bcm2835-1.35
- # 配置
- ./configure
- # 从源代码生成安装包
- make
- # 执行检查
- sudo make check
- # 安装 bcm2835库
- sudo make install
3.WiringPi
官网:http://wiringpi.com/
开发者:
安装:见另一篇博文
以下原文:http://blog.csdn.net/xukai871105/article/details/12684617
0.前言
更多树莓派学习笔记请参考——【树莓派学习笔记——索引博文】
树莓派来自国外,国外嵌入式开源领域具有良好的分享精神,树莓派各种集成库也层出不穷,下面推荐几个。
1.硬件准备
2.程序实现
2.1 Python
- sudo aptitude install python-dev
- # 下载
- $ wget http://raspberry-gpio-python.googlecode.com/files/RPi.GPIO-0.5.3a.tar.gz
- # 解压缩
- $ tar xvzf RPi.GPIO-0.5.3a.tar.gz
- # 进入解压之后的目录
- $ cd RPi.GPIO-0.5.3a
- # 启动安装
- $ sudo python setup.py install
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import RPi.GPIO as GPIO
- import time
- GPIO.setmode(GPIO.BOARD)
- # need to set up every channel which are using as an input or an output
- GPIO.setup(11, GPIO.OUT)
- while True:
- GPIO.output(11, GPIO.HIGH)
- time.sleep(1)
- GPIO.output(11, GPIO.LOW)
- time.sleep(1)
2.2 wiringPi
- #include <wiringPi.h>
- main ()
- {
- wiringPiSetup () ;
- pinMode (0, OUTPUT) ;
- for (;;)
- {
- digitalWrite (0, HIGH) ; delay (500) ;
- digitalWrite (0, LOW) ; delay (500) ;
- }
- }
2.3 BCM2835 C Library
BCM2835 C Library 安装
- # 下载
- $ wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.35.tar.gz
- # 解压缩
- $ tar xvzf bcm2835-1.35.tar.gz
- # 进入解压之后的目录
- $ cd bcm2835-1.35
- # 配置
- ./configure
- # 从源代码生成安装包
- make
- # 执行检查
- sudo make check
- # 安装 bcm2835库
- sudo make install
- #include <bcm2835.h>
- // Blinks on RPi Plug P1 pin 11 (which is GPIO pin 17)
- #define PIN RPI_GPIO_P1_11
- int main(int argc, char **argv)
- {
- if (!bcm2835_init())
- return 1;
- // Set the pin to be an output
- bcm2835_gpio_fsel(PIN, BCM2835_GPIO_FSEL_OUTP);
- // Blink
- while (1)
- {
- bcm2835_gpio_write(PIN, HIGH);
- bcm2835_delay(100);
- bcm2835_gpio_write(PIN, LOW);
- bcm2835_delay(100);
- }
- bcm2835_close();
- return 0;
- }
3.未来想法
4.树莓派博文链接
关于RPi.GPIO、BCM2835 c library、WiringPi、Gertboard的更多相关文章
- RPi.GPIO 和 HM
后续笔记不再记录导入的模块和硬件的连接方法,请根据关键词自行搜索. RPi.GPIO模块 GPIO:General Purpose Input Output 即 通用输入/输出 RPi.GPIO是一个 ...
- 【玩转开源】BananaPi R2——移植RPi.GPIO 到 R2
1. 首先给大家介绍一下什么是RPi.GPIO. 简单去讲,RPi.GPIO就是一个运行在树莓派开发板上可以通过Python去控制GPIO的一个中间件. 现在我这边做了一个基础功能的移植,接下来大家可 ...
- 树莓派 - RPi.GPIO
RPi.GPIO是通过Python/C API实现的,C代码操作底层寄存器, python通过Python/C API调用这些C接口. 这是关于RPi.GPIO项目的介绍. 其中提到了有python ...
- nanopi NEO2 学习笔记 3:python 安装 RPi.GPIO
如果我要用python控制NEO2的各种引脚,i2c 或 spi ,RPi.GPIO模块是个非常好的选择 这个第三方模块是来自树莓派的,好像友善之臂的工程师稍作修改移植到了NEO2上,就放在 /roo ...
- 树莓派RPi.GPIO+Flask构建WebApi实现远程控制
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import RPi.GPIO as GPIO from flask import Flask, requ ...
- 友善RK3399/NanoPC-T4开发板wiringPi的C语言访问GPIO外设实例讲解 -【申嵌视频】
1 wiringPi简介 wiringPi库最早是由Gordon Henderson所编写并维护的一个用C语言写成的类库,除了GPIO库,还包括了I2C库.SPI库.UART库和软件PWM库等,由于w ...
- 树莓派 -- bcm2835 library (1)
bcm2835 library提供了user space 操作IO的代码. 本文不涉及代码分析,先直观的按照user guide完成操作. 1. 在Raspberry中安装bcm2835 librar ...
- RPi 2B GPIO 测试
/************************************************************************************** * RPi 2B GPI ...
- 树莓派学习路程No.1 GPIO功能初识 wiringPi安装
WiringPi是应用于树莓派平台的GPIO控制库函数,WiringPi遵守GUN Lv3.wiringPi使用C或者C++开发并且可以被其他语言包转,例如python.ruby或者PHP等.Wiri ...
随机推荐
- 继上一篇随笔,优化3张以上图片轮播React组件
import React from 'react'; import PropTypes from 'prop-types'; import {getSwipeWay} from '../utils/s ...
- 【模板】任意模数NTT
题目描述: luogu 题解: 用$fft$水过(什么$ntt$我不知道). 众所周知,$fft$精度低,$ntt$处理范围小. 所以就有了任意模数ntt神奇$fft$! 意思是这样的.比如我要算$F ...
- Bzoj3170: [Tjoi2013]松鼠聚会 (切比雪夫距离)
题目链接 显然,题目要求我们求切比雪夫距离,不会的可以去看一下attack的博客. 考虑枚举所有的点 转换为曼哈顿距离后. 那么对于这个点的路程和是. \[\sum_{i=1}^n | x_i - x ...
- 初涉tarjan缩点
tarjan缩点:口胡过好多题,不过从来没写过…… 什么是缩点 tarjan和Kosaraju.Gabow算法一样,是为了求有向图中的强连通分量.因为有向图中大多数情况下会有环存在,而有环是一个不甚好 ...
- database---many to many relationships(多对多关系型数据库)
Many to many Relationships A many-to-many relationship occurs when multiple records in a table are a ...
- perl学习之HERE文档
Perl的here文档机制是从UNIX shell中的here文档机制派生而来的. 和在shell中一样,Perl中的here文档也是面向行的引用表单,要求提供<<运算符,其后跟随一个初始 ...
- Python中如何将数据存储为json格式的文件
一.基于json模块的存储.读取数据 names_writer.py import json names = ['joker','joe','nacy','timi'] filename='names ...
- Linux等待队列与唤醒
1.数据结构 1.1等待队列头 struct __wait_queue_head { spinlock_t lock; struct list_head task_list; }; typedef s ...
- 几条sql语句(exists)
通常exists后的子查询是需要和外面的表建立关联关系的,如 select count(*) from a where exists (select 'x' from b where a.id = b ...
- Java-终止应用程序
参考了:http://www.cnblogs.com/xwdreamer/archive/2011/01/07/2297045.html 理论在上面链接中有详细的解释 package com.tj; ...