I got it to work well, but when doing some tests I discovered that if I take the T value of a port A it works, but if that value left it fixed, just one cycle of while
#define unsigned long T;
void loop(){
T= analogRead(A0); //map of 1 a 100
................................
while(){
................................
}
}
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
unsigned long T = getEvaluate<input_SIG>(ctx); // mapped signal 1 -100 **works**
unsigned long T = 50; // **it does not work**
while() {
......................................
emitValue<output_OUT>(ctx, .....
}
}
If I take the signal, the mapping from 1 to 100 works.
If I assign T a value of 50 only a while ago, surely when changing the port the value oscillates and works for those things that happen. But I’m missing the loop, is it possible in XOD?
I already put it like that but nothing worked.
To be honest, I don’t quite understand what are you trying to achieve. A sine wave generator? If so, have you seen xod/core/sine-wave? Regardless of anything, you are using delay in the while loop which will lead to unwanted consequences.
The delay function wastes CPU cycles and blocks everything (including evaluation of other parts of the program) until the time is elapsed. You have to refactor the evaluate implementation to be called more often (see setTimeout) and without any delay calls.
Hi, sine-wave node works, but after a day the behavior is erratic. At least in my tests.
This is a program that I found and is already working correctly,
one problem was the data type of the variable and another the map value at 255 should be 254000.
That’s right, the cycles are from 0.5 sec to 10 sec, not very useful
sounds like a bug related to an overflow or float precision. Would you elaborate? Does it go crazy in a moment, right after 49 hours (2³² ms overflow) or degrade slowly after a few hours?