File tree Expand file tree Collapse file tree 4 files changed +70
-0
lines changed Expand file tree Collapse file tree 4 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 1+ # Dependency directories
2+ node_modules /
3+
Original file line number Diff line number Diff line change 1+ # pigpio-dht
2+ Dht22 control using node.js and pigpio.
3+
4+ ## Installation
5+ 1 . Install [ pigpio C library] ( https://github.com/joan2937/pigpio ) .
6+ 2 . Install module dependencies: ` npm i pigpio-dht ` .
7+
8+ ## usage
9+ TODO
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ const Gpio = require ( 'pigpio' ) . Gpio ;
3+
4+ module . exports = function ( pin , type ) {
5+ const gpio = new Gpio ( pin , { mode : Gpio . OUTPUT , pullUpDown : Gpio . PUD_OFF } ;
6+
7+ gpio . trigger ( 80 , 0 ) ;
8+
9+ gpio . enableAlert ( ) ;
10+ gpio . disableAlert ( ) ;
11+
12+ gpio . on ( 'alert' , ( level , tick ) => {
13+ //TODO communication logic goes here
14+ var startTick = 0xffffffff ; // 2^32-1 or 4294967295, the max unsigned 32 bit integer
15+ var endTick = 1 ;
16+ console . log ( ( endTick >> 0 ) - ( startTick >> 0 ) ) ; // prints 2 which is what we want
17+ } ) ;
18+
19+ function trigger ( ) {
20+ //Trigger a new relative humidity and temperature reading.
21+
22+ //TODO implement
23+ /*self.pi.write(self.gpio, pigpio.LOW)
24+ time.sleep(0.017) // 17 ms
25+ self.pi.set_mode(self.gpio, pigpio.INPUT)
26+ self.pi.set_watchdog(self.gpio, 200)*/
27+ }
28+ } ;
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " pigpio-dht" ,
3+ "version" : " 1.0.0" ,
4+ "description" : " DHT implementation using node.js and pigpio." ,
5+ "main" : " index.js" ,
6+ "scripts" : {
7+ "test" : " echo \" Error: no test specified\" && exit 1"
8+ },
9+ "repository" : {
10+ "type" : " git" ,
11+ "url" : " git+https://github.com/depuits/pigpio-dht.git"
12+ },
13+ "keywords" : [
14+ " DHT" ,
15+ " DHT22" ,
16+ " pigpio"
17+ ],
18+ "author" : " depuits" ,
19+ "license" : " ISC" ,
20+ "bugs" : {
21+ "url" : " https://github.com/depuits/pigpio-dht/issues"
22+ },
23+ "homepage" : " https://github.com/depuits/pigpio-dht#readme" ,
24+ "devDependencies" : {
25+ "pigpio-mock" : " 0.0.1"
26+ },
27+ "dependencies" : {
28+ "pigpio" : " ^0.6.4"
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments