Hi guys,
I’m trying to get the time in milliseconds for when a binary digital sensor is on FALSE.
O know there is a tine delta functions but it returns 2 decimals instead of 3 and I need it to be a bit mor accurate.
How can I do this?
Hi guys,
I’m trying to get the time in milliseconds for when a binary digital sensor is on FALSE.
O know there is a tine delta functions but it returns 2 decimals instead of 3 and I need it to be a bit mor accurate.
How can I do this?
pulse-in might be the node you are looking for. It exists in robertspark/components — XOD
I tried it earlier, it doesn’t work.
Will try again and post a screenshot here a bit later.
How did you determine the resolution of the time delta functions? I doubt anything in Arduino returning a floating point number only has 2-digit resolution. Are you sure you were not using a display function that was defaulting to 2 decimal place display and rounding what you were seeing?
I’m trying again now, trying to het the time in debug mode instead of my lcd but without any success.
The sensors I’m using is a light barrier made of a “flame sensor” (ir receiver with a comparator included, has both digital and analog outputs) and an ir led.
If I’m using time delta it works but resolution is not big enough, with pulse-in doesn’t work at all.
Sorry maybe I’m not correct, when I say resolution I’m talking about the number of decimals after the point.
Watch nodes are only going to show 2 decimal points regardless of the number being displayed (0.123 is going to display as 0.12)
Format-number node will allow you to change the default behavior
The flame sensors I’ve seen are not sending a pulse, they send a voltage. Yours might be different, but normally you would just use an analog-read of the port it is connected to. In XOD, that will return a number between 0 & 1 (which would be the equivalent of 0-1024 in Arduino IDE). The closer to 0, the more intense (or closer) the flame.
I think this does something similar to what you’re looking for?
Example of using microsecond timer with button trigger:
example-microsecond-timer.xodball (16.4 KB)
Indeed but it’s outputting a string.
Nevertheless, is I take the value from delta time and put it into a calculation, how many decimals are involved in the actual arithmetical operation?
Regarding the flame sensor, this is the one I have and it has both analogic and digital outputs because it’s having the internal comparator which is comparing the analog value with a value you set up using the potentiometer (sensitivity).
It’s very versatile in this configuration because I can easily inceease or decrease sensitivity to reduce the effect of ambient light.
I’m not sure the exact true precision, but the node inside I made to go from microseconds to milliseconds used float
node {
void evaluate(Context ctx) {
float micros = getValue<input_IN>(ctx);
emitValue<output_OUT>(ctx, micros / 1000 );
}
}
The decimals of milliseconds are correct to at least 3 decimal places, since it’s derived from microseconds. I can’t think of a way to get more than 3 decimals after milliseconds.
As far as the output… It’s a number… The string you see is XOD processing through a “Watch” node, which helps you see what’s going on during Debug Mode. Output is a number - should be of type “float”.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.