Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infrared Sensor PROX #25

Open
codeadamca opened this issue Mar 6, 2018 · 2 comments
Open

Infrared Sensor PROX #25

codeadamca opened this issue Mar 6, 2018 · 2 comments

Comments

@codeadamca
Copy link

codeadamca commented Mar 6, 2018

Hello, I am using the infrared sensor. I have NodeJS checking the proximity every 500 milliseconds. But the numbers seem very random. If I monitor the /sys/class/lego-sensor/sensor1/value0 file, it seems accurate. But the Infrared.getValue(0) does not.

Here my code that is being called every 500 milliseconds:

var ev3dev = require("ev3dev-lang");

var sensor = new ev3dev.InfraredSensor( ev3dev["INPUT_2"] );
sensor.mode = "IR-PROX";
console.log(sensor.getValue(0));
console.log(sensor.proximity);

Any help would be appreciated.

@WasabiFan
Copy link
Owner

I'm having trouble imagining a reason for the behavior you're seeing. Are you sure you're looking at the same sensor? And are pointing it in the same direction with the same expected result? Is it possible that the slowness of the EV3 (and, by extension, the inconsistency of any timers) is causing this?

If you can provide a sample of the readings from the two sources I might be able to spot a pattern.

@codeadamca
Copy link
Author

I'm using a Pi3 and a BrickPi3. Would that make a difference?
When I'm testing it's the only sensor I'm using. It's the same for the IR-SEEK. I'll send some data samples when I have a minute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants