Closed nishendra closed 10 years ago
Hi, @nishendra thank you for reporting this. I just pushed a commit that should correct your problem. Can you please try from the dev
branch? Thank you!
Also, note there is evented way to do the same thing:
var Cylon = require('cylon');
Cylon.robot({
connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' },
device: {
name: 'sensor',
driver: 'ir-range-sensor',
pin: 0,
model: 'gp2y0a41sk0f'
},
work: function(my) {
my.sensor.on('range', function(data) {
console.log('Range ===>', data);
});
}
}).start();
Hi @deadprogram you are welcome! I tried using the dev branch and now the values are recorded correctly. Thank you!
This has been fixed, closing the issue.
There's a problem with the infrared proximity sensor driver where the distance value always returns 0. In the following example given here:
The "Range" always shows as 0. Going through the code on ir-range-sensor.js in cylon-gpio,
and logging "this.analogVal" in the console, I found that it is "undefined", hence the condition in the "if" statement never evaluates to "true" and therefore "dist" is always returned as 0.