FirmateWebClient: a simple way to access sensors&actuators

userHead LattePanda 2016-12-15 16:04:16 8023 Views2 Replies
FirmateWebClient provides a minimum HTTP-based firmata controller for various hardware, typically Arduino. This extends user's control and monitoring of the hardware using platform-independant URL requests.
Click here to see more information. https://github.com/LattePandaTeam/Latte ... troduction

Support list:
1. Digital Pins
2. Analog Pins
3. PWM
4. Servo
This is just a few of the many possibilities. We welcome you build, extend and experiment with the features you need.

Here is all the code you need to build a NodeJS project and turn on an LED, you can see all the examples in /examples folder.

Code: Select all

var http = require('http'); var querystring = require('querystring'); var url = { hostname: '192.168.2.37',//device ip port: 23456, path: '/read_all_pins',//read all pins method: 'GET' }; //send get request var req = http.request(url,function(res){ res.setEncoding('utf8'); res.on('data',function(chunk){ var returnData = JSON.parse(chunk); console.log('D9 state: %s',returnData.data['9']); }); }); req.on('error', function(e){ console.log('error' + e.message); }); req.end(); Look forward to any suggestions and feedback!