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
wrong read from dynamic array #2112
Comments
Found a solution: the array is increased by 1 element. I don't use the last element of the array, but now the output is correct. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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;
void init()
{
A = new int[a];
}
if (isSettingUp()) {
// This run once
int nValue = getValue<input_N>(ctx);
a = nValue + 1;
i = 1;
init(); }
if (isInputDirty<input_UPD>(ctx)) {
}
emitValue<output_OUT1>(ctx, A[i]);
emitValue<output_OUT2>(ctx, A[5]); //diagnotstic data
}
}
data-delay.zip
`
The text was updated successfully, but these errors were encountered: