-
Couldn't load subscription status.
- Fork 124
Open
Description
I'm trying to write node for delay of row of numbers, which enter the input sequentially.
Row of nombers is random of 1-5.
in line 37 the value nomber 'i' is output from the array.
But when nValue=5, i=6, Arduino Uno outputs '60'. Wherein A[5] not equal 60.
`node {
unsigned int i;
int a;
int *A;
int counter(unsigned int index, unsigned int nValue) {
if (index > (nValue)) {
return 1;
}
else {
return index=index+1;
}
}
void init()
{
A = new int[a];
}
void evaluate(Context ctx) {
if (isSettingUp()) {
// This run once
int nValue = getValue<input_N>(ctx);
a = nValue + 1;
i = 1;
init(); }
if (isInputDirty<input_UPD>(ctx)) {
int inValue = getValue<input_IN>(ctx);
A[i] = inValue;
int nValue = getValue<input_N>(ctx);
i = counter(i, nValue);
if(!isInputDirty<input_UPD>(ctx));
}
emitValue<output_OUT1>(ctx, A[i]);
emitValue<output_OUT2>(ctx, A[5]); //diagnotstic data
}
}
data-delay.zip
`
Metadata
Metadata
Assignees
Labels
No labels