Hi everybody,
I'm trying to run the following program; it compiles, but it never starts. :'(
Reducing the array size makes it run but I need to use a pretty big array.
1000 short ints should not overflow ATmega168 memory, should they?
1000 * 16 bit = 1000 * 2 byte = 2000 byte
(compiling this program returns:
" 2838 bytes (of a 14336 byte maximum)")
Why is it happening?
Thank you very much!
#define L 1000
short speed[L];
int gyroPin = 0;
void setup() {
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
}
void loop() {
long int last = 0;
long int now = 0;
last = millis();
for(int i=0; i<L; i++) {
now = millis();
while(now == last) { // wait until 1 ms elapses
delayMicroseconds(50);
now = millis();
}
speed[i] = analogRead(gyroPin);
}
send();
}
void send() {
Serial.begin(9600);
Serial.println("Ang speed-----------------");
for(int i=0; i<L; i++) {
Serial.println(speed[i]);
}
while(1);
}