Why is Array Declaration Causing Error?
my sketch failing, , i've narrowed down problem array declaration. have 2 arrays: 1 holding x position, , 1 holding y position, of row of sensors. scanning sensors find 1 activated, , passing number "sensorx[]" , "sensory[]" arrays x,y position of sensor.
when upload code arduino, doesn't run anything. it's if found magic kill switch. when comment out "sensorypos[snum]" lines of code. sketch uploads , works, except can't receive y position of sensor.
any thoughts why array crashing code? thanks!!
quote
int sensorxpos[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,5,10,15,20,25,30,35,40,45,50,56,61,66,71,76,81,86,91,96,101,106,
111,117,122,127,132,137,142,147,152,157,163,168,173,178,183,188,
193,198,203,208,213,219,224,229,234,239,244,249,254,259,264,269,
274,279,284,290,295,300,305,310,315,320,321,321,321,321,321,321,
321,321,321,321,321,321,321,321,321,321,321,321,321,321,321,321,321};
int sensorypos[] = {
0,5,10,15,20,25,30,35,40,45,50,56,61,66,71,76,81,86,91,96,101,
106,111,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,111,106,101,96,91,86,81,76,71,66,61,56,50,45,40,35,30,25,
20,15,10,5,0};
void loop(){
scanltr('l');
if(laserlshadow != 200){
serial.print("left: ");
serial.print(sensorxpos[snum]);
serial.print(",");
serial.println(sensorypos[snum]);
serial.println();
}
scanltr('r');
if(laserrshadow != 200){
serial.print(" right: ");
serial.print(sensorxpos[snum]);
serial.print(",");
serial.println(sensorypos[snum]);
serial.println();
}
}
when upload code arduino, doesn't run anything. it's if found magic kill switch. when comment out "sensorypos[snum]" lines of code. sketch uploads , works, except can't receive y position of sensor.
any thoughts why array crashing code? thanks!!
quote
my sketch failing
your sketch, posted, incomplete.
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Why is Array Declaration Causing Error?
arduino
Comments
Post a Comment