This is my code, if I remove the if statement inside the last while loop everything works fine but with the if statement the code only runs untill the last while statement. The code creates two arrays and compares the both to find values with a difference of 0.5.What am I doing wrong?
void setup(){
Serial.begin(115200);
}
void loop() {
float array1[64];
float array2[64];
String uval1 = "";
String uval2 = "";
String uval3 = "";
int i = 0;
int j = 0;
int k = 0;
int l = 0;
int m = 0;
while (i < 64) {
array1[i] = random(2000,3000)/100.0;
array2[i]= array1[i];
uval1+=array1[i];
uval1+=",";
i++;
}
Serial.println("array1=" + uval1);
delay(1000);
while (j<5){
float value=random(2000,3000)/100.0;
int index=random(0,64);
array2[index]=value;
Serial.println((String)value+" at "+index);
j++;
}
while (k < 64) {
uval2+=array2[k];
uval2+=",";
k++;
}
Serial.println("array2=" + uval2);
delay(1000);
while (l<64){
if ((array1[l]+0.5)<array2[l] || array2[l]<(array1[l]-0.5)){
Serial.print((String)array2[l]+" at "+l);
array1[l]=array2[l];
l++;
}
delay(10000);
}}
**Exception:
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3584, room 16
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac
~ld
Soft WDT reset
stack>>>
ctx: cont
sp: 3ffffb90 end: 3fffffc0 offset: 01a0
3ffffd30: 00000000 3ffe8610 41ae6666 4020128d
3ffffd40: 41ae6666 41e228f6 41a9c28f 41ca28f6
3ffffd50: 41b7c28f 41ba3d71 41d47ae1 41af47ae
3ffffd60: 41a6f5c3 41e9d70a 41e0b852 41cc28f6
3ffffd70: 41b1d70a 41b88f5c 41cd47ae 41d6b852
3ffffd80: 41dcb852 41e7eb85 41ee7ae1 41ca8f5c
3ffffd90: 41ae147b 41b43d71 41deb852 41b1c28f
3ffffda0: 41ba147b 41d26666 41a0a3d7 41d93333
3ffffdb0: 41bf47ae 41db47ae 41eb999a 41c2cccd
3ffffdc0: 41dd5c29 41a2b852 41b63d71 41b4e148
3ffffdd0: 41abae14 41cca3d7 41a35c29 41a1999a
3ffffde0: 41e03d71 41c747ae 41b71eb8 41ee8f5c
3ffffdf0: 41a7ae14 41e570a4 41c75c29 41c88f5c
3ffffe00: 41ddeb85 41c95c29 41d43d71 41c9ae14
3ffffe10: 41ddc28f 41af1eb8 41c9d70a 41d46666
3ffffe20: 41b347ae 41e0cccd 41c00000 41e3eb85
3ffffe30: 41d770a4 41b2147b 41b71eb8 41c651ec
3ffffe40: 41ae6666 41e228f6 41a9c28f 41ca28f6
3ffffe50: 41b7c28f 41ba3d71 41d47ae1 41af47ae
3ffffe60: 41eee148 41e9d70a 41e0b852 41cc28f6
3ffffe70: 41b1d70a 41b88f5c 41cd47ae 41d6b852 **