I'm trying to read data from my DHT22 Humidity/Temperature sensor using Bonescript. Being new to Bonescript, I am having trouble getting started with having my Beaglebone Black Rev C, running Debian, to communicate with the DHT22 using Bonescript.
So far I have:
Code: Select all
var b = require('bonescript');
var pin = "P8_19";
b.pinMode(pin, b.INPUT);
I have tried slightly modifying sample node.js code generously provided by Andrew Rohne (https://gist.github.com/KE8P/5024198) thinking I could easily go to Bonescript later on. This code works for him if you want to see it yourself on his blog (http://www.ke8p.us/raspberrypi/raspberr ... re-monitor):
Code: Select all
var sys=require("sys");
var exec=require("child_process").exec;
var child;
var http=require("http");
var Stdout;
child=exec("Adafruit_DHT 22 P8_19",function(error, stdout,stderr){
Stdout=stdout;
});
http.createServer(function(request,response){
response.writeHead(200,{"Content-Type":"text/plain"});
response.write(Stdout);
response.end();
}).listen(8888);
For the record, I have already successfully been getting readings from the DHT22 with python through Adafruit's_Python_DHT directory, so no faulty sensor issues.
Any advice is welcome! Thanks in advanced for the help!