Skip to content

Commit cfc2e21

Browse files
authored
Merge pull request #44 from TizenTeam/sandbox/rzr/review/master
doc: Shift to generic sysfs module
2 parents 53625ab + 22ee126 commit cfc2e21

File tree

1 file changed

+39
-17
lines changed

1 file changed

+39
-17
lines changed

README.md

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
1-
# gpio - talk to your Raspberry Pi's gpio headers
1+
# gpio - talk to your Single Board Computer's gpio headers
22

3-
* demo using LED: http://www.youtube.com/watch?v=2Juo-CJ6eu4
4-
* demo using RC car: http://www.youtube.com/watch?v=klQdX8-YVaI
53

4+
## Introduction
65

7-
## Important note
8-
I haven't maintained this project for a while now, and it's unlikely I will provide any updates going forward given other more mature gpio libraries out there. If you're looking for a reliable way to communicate with the raspberry pi in JavaScript, check out the [wiring-pi JavaScript library](https://www.npmjs.com/package/wiring-pi). It provides direct bindings to the fully-featured [Wiring Pi C library](http://wiringpi.com/).
6+
This plain JavaScript module is generic and only rely on system's *sysfs*.
7+
8+
Please consider other (more mature) gpio libraries out there which support better your hardware,
9+
10+
For instance, of you're looking for a reliable way to communicate with the Raspberry Pi using JavaScript,
11+
check out the [wiring-pi JavaScript library](https://www.npmjs.com/package/wiring-pi).
12+
It provides direct bindings to the fully-featured [Wiring Pi C library](http://wiringpi.com/).
13+
14+
But if you want/need a generic lightweight module, this one can be used as fallback.
15+
16+
## Support
17+
18+
Following hardware was reported to work (with some limitations or workarounds)
19+
20+
* ARTIK10 (inputs' pull down resistors are enabled by default)
21+
* Raspberry Pi (use wiringpi's /usr/bin/gpio to change mode: gpio -g mode 11 up)
922

10-
---
1123

1224
## Installation
13-
##### Get node.js on your Raspberry Pi
14-
On Raspbian, you can simply run `apt-get install nodejs`,
15-
otherwise, [compile it](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager)
25+
26+
Get node.js for your SBC,
27+
If using Debian or deviates (Raspbian for RPi), you can simply run:
28+
sudo apt-get install nodejs
29+
30+
otherwise, install from node or [compile it](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager)
1631

1732
## Usage
1833

@@ -21,9 +36,9 @@ This library is an npm package, just define "gpio" in your package.json dependen
2136
npm install gpio
2237
```
2338

24-
##### Note: you must be running as root or have the proper priviledges to access the gpio headers
39+
Note: you must be have proper privileges to access the GPIO headers (or run node as root).
2540

26-
##### Standard setup
41+
### Standard setup
2742

2843
```js
2944
var gpio = require("gpio");
@@ -46,7 +61,8 @@ var gpio4 = gpio.export(4, {
4661
});
4762
```
4863

49-
##### Header direction "in"
64+
### Header direction "in"
65+
5066
If you plan to set the header voltage externally, use direction `in` and read value from your program.
5167
```js
5268
var gpio = require("gpio");
@@ -57,7 +73,7 @@ var gpio4 = gpio.export(4, {
5773
});
5874
```
5975

60-
##### API Methods
76+
## API Methods
6177

6278
```js
6379
// sets pin to high
@@ -82,7 +98,8 @@ gpio4.set(0, function() {
8298
gpio4.unexport();
8399
```
84100

85-
##### EventEmitter
101+
### EventEmitter
102+
86103
This library uses node's [EventEmitter](http://nodejs.org/api/events.html) which allows you to watch
87104
for value changes and fire a callback.
88105
```js
@@ -108,7 +125,9 @@ gpio4.setDirection("in");
108125
```
109126

110127
## Example
111-
##### Cycle voltage every half a second
128+
129+
### Cycle voltage every half a second
130+
112131
```js
113132
var gpio = require("gpio");
114133
var gpio22, gpio4, intervalTimer;
@@ -149,7 +168,10 @@ setTimeout(function() {
149168
}, 10000)
150169
```
151170

171+
## References
152172

153-
##### Controlling an RC car
154-
Source code here: https://github.com/EnotionZ/node-rc
173+
Demos on Raspberry Pi:
155174

175+
* Demo using LED: http://www.youtube.com/watch?v=2Juo-CJ6eu4
176+
* Demo using RC car: http://www.youtube.com/watch?v=klQdX8-YVaI
177+
* Source code here: https://github.com/EnotionZ/node-rc

0 commit comments

Comments
 (0)