I’m currently writing a small api to send and receive data from the homeduino (arduino).
But for now I’m stuck on how to connect to homeduino without the pimatic framework…
This is my code (some customizing from the github help and the files):
var Board, board, homeduino;
homeduino = require('homeduino');
Board = homeduino.Board;
var serialDevice = '/dev/ttyUSB0';
var baudrate = '115200';
board = new Board("serialport", {
serialDevice: serialDevice,
baudrate: baudrate
});
console.log(("connecting to " + serialDevice + " with " + baudrate));
board.on("data", (function() {
return function(data) {
return console.log("data: \"" + ("" + data) + "\"");
};
}));
board.connect().then((function() {
return function() {
console.log("connected to homeduino");
};
}));
error:
Unhandled rejection TimeoutError: operation timed out
at afterTimeout (/funkmodul/node_modules/homeduino/node_modules/bluebird/js/main/timers.js:11:15)
at timeoutTimeout (/funkmodul/node_modules/homeduino/node_modules/bluebird/js/main/timers.js:53:9)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
where is the timeout? I’m not using the function
This reverse engineering is bothering me
Any help would be greatly appreciated!