https://github.com/ivanhao/raspberry-code
https://github.com/ivanhao/raspberry-code
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ivanhao/raspberry-code
- Owner: ivanhao
- Created: 2015-07-27T04:38:01.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-02-03T09:22:31.000Z (over 10 years ago)
- Last Synced: 2025-03-13T18:51:41.669Z (over 1 year ago)
- Language: C
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# raspberry-code
This codes are records for my raspberry Pi using wiringPi.Including servos,temperature's sensor and so on.
## first
you must install wiringPi in your Raspberry Pi.
###download wiringPi:
`git clone git://git.drogon.net/wiringPi`
###make and install:
```
cd wiringPi
./build
```
# raspberry-code
这些是树莓派上用wiringPi的一些代码记录。
## 首先
你要在树莓派上安装wiringPi。
###下载 wiringPi:
`git clone git://git.drogon.net/wiringPi`
###安装:
`cd wiringPi`
`./build`
###使用:
用vi或者nano新建一个blink.c的文件:
`vi blink.c`
内容如下:
```
#include
int main( )
{
// 初始化wiringPi
wiringPiSetup();
int i = 0;
// 设置IO口全部为输出状态
for( i = 0 ; i < 8 ; i++ )
pinMode(i, OUTPUT);
for (;;)
{
for( i = 0 ; i < 8 ; i++ )
{
// 点亮500ms 熄灭500ms
digitalWrite(i, HIGH); delay(500);
digitalWrite(i, LOW); delay(500);
}
}
return 0;
}
```
编译:
```
blink:blink.o
gcc blink.c -o blink -lwiringPi
clean:
rm -f blink blink.o
```