adjustments for testing

This commit is contained in:
Shannon Sterz 2016-01-18 22:35:01 +01:00
parent 41544ff508
commit c97fa08e06
3 changed files with 10 additions and 1 deletions

View file

@ -29,10 +29,14 @@ void loop()
void decodeMessage() {
if(com) {
int cmd = message[0];
Serial.println(cmd);
int pin = message[1] - 97;
Serial.println(pin);
int val[6];
memcpy(val, message + 2, 6);
for(int i =0;i<6;i++) {Serial.println(val[i]);}
switch (cmd) {
//case 80: break;
//case 81: break;

View file

@ -37,9 +37,11 @@ Arduino.prototype.setup = function () {
self.serial.on('open', function () { setTimeout(function () {
self.serial.write(new Buffer('00000000'));
self.serial.write(new Buffer('Z0000000', 'ascii'));
self.emit('success');
self.serial.on('data', function(data){
console.log(data);
self.emit('data', data);
});

View file

@ -11,7 +11,10 @@ router.get('/', function(req, res, next) {
});
router.get('/toggleLight', function (req, res) {
arduino.write(new Buffer('~','ascii'));
var s = "0FFF0FFF000F";
var str = "";
for(i = 0; i < s.length; i+=2) { str += String.fromCharCode(parseInt(s.substr(i,2), 16)); }
arduino.write(new Buffer('Wa' + str,'ascii'));
res.send('switch light');
});