posting sensor data to Rails app - Raspberry Pi Forums


how can post sensor data rails app via rpi? (preferably using ruby or javascript :d )

not sure if makes difference planning use mcp3008 analog-to-digital converter.

write in javascript node.js. sending data server via http post request easy as:

code: select all

var request = require('request'); var myjsonobject = { x: 1,  y: 666, z: 42};  request({     url: "http://josiahchoi.com/myjson",     method: "post",     json: true,   // <--very important!!!     body: myjsonobject }, function (error, response, body){     console.log(response); }); 
see discussion here: http://stackoverflow.com/questions/6158 ... in-node-js

learn node.js on pi here: https://learn.adafruit.com/node-embedde ... ode-dot-js

see here: https://nodejs.org/

have replacing old rails server node.js server :)


raspberrypi



Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support