Hi guys,
im new to this all. Build up my own arduino board alá "build-by-hand" (http://arduino.cc/en/Main/ArduinoBoardSerialSingleSided3) and now im figuring out what its all about.
I was wondering why the this code...
const int range = 361;
int field1[range];
//int field2[range];
int ctr = 0;
int pushButton = 2;
int led = 13;
int dR(int pin){return digitalRead(pin);}
void dW(int pin, int signal){digitalWrite(pin,signal);}
void d(int milis){delay(milis);}
void blinking()
{
dW(led,HIGH);
d(20);
dW(led,LOW);
d(20);
}
void fill(){
for(int i = 0; i < range;i++){
field1[i] = i;
//field2[i] = i;
}
}
void setup() {
fill();
Serial.begin(9600);
pinMode(pushButton, INPUT);
pinMode(led, OUTPUT);
}
void loop() {
int buttonState = dR(pushButton);
if(buttonState == 1)
{
Serial.println(field1[ctr]);
//Serial.println(field2[ctr]);
if(ctr >= range)
ctr=0;
else
ctr++;
while(buttonState){
blinking();
buttonState=dR(pushButton);
}
}
delay(1);
}
...works fine,
but if i try to use a bigger range (>361) or two or more arrays, it seems like the function fill crashes.And i wont get anything onto the serial monitor.The ATmega168 has 1KB of SRAM, so it should take some more than 361 integers^^.
Has anyone a clue ?
Thank's !
MosFett