hobbyquaker/cul

No response from CULv3

Closed this issue · 3 comments

I used the sample code from the readme and adapted it a bit, but I don't get an answer and the ready event isn't fired.

var Cul = require('cul');
var cul = new Cul({
    serialport: '/dev/ttyACM0',
    mode: 'AskSin'
});

cul.on('close', function () {
    console.log('serial connection closed');
});

cul.on('ready', function () {
    console.log('ready');
    cul.write('V');
});

cul.on('data', function (raw) {
    console.log(raw);
});

console.log('all events registered');

It only outputs all events registered.

node version: v0.10.29

seems like it doesn't open the serialport. Have you doublechecked that /dev/ttyACM0 is correct? Are you using a RaspberryPi?

I cloud solve my problem by using the callback in the drain function instead of the write function of the serial port module, see the pull request.
I'm testing the software on normal pc hardware with Ubuntu 16.04 / Debian 8.

I must admit I don't understand it until now. The write callback should fire before the drain callback (if I don't misunderstand node-serialport), so I can't explain to myself why this would solve your issue. Will do some tests and tinkering at the weekend.