float vteste[100];
int vconta = 0;
void loop()
{
vconta = (vconta + 1) % 100;
vteste[vconta] = 1.123456;
Serial.println(vteste[vconta]);
}
Hi!!
I'm using an array but its freezing my atmega328P.
If I use "1.1" or "1" value instead of "1.123456" it works. But when the value is higher it freeezes.
is that a way to solve that, since I need to use arrays?
Any idea will be apreciated.
Tks
system
February 26, 2014, 1:55pm
2
That's not all your code.
If you are concerned about SRAM, Arduino IDE 1.5.x will give you this info during compile check/upload OR if you are using 1.0.5 or lower, you can use this script (iOS, Linux, Windows versions avail.) to see the same info:
http://forum.arduino.cc/index.php?topic=196101.0
Ray
100 x 4 bytes for a float is only 400 bytes of 2048 available.
What other variables do you have?
system
February 26, 2014, 2:38pm
5
float vteste[100];
int vconta = 0;
void setup ()
{
Serial.begin (115200);
}
void loop()
{
vconta = (vconta + 1) % 100;
vteste[vconta] = 1.123456;
Serial.println(vteste[vconta], 6);
}
No problems at all on a 168-based Duemilanove.
Post all your code.
Hi! My code is just like yours and even if I copy and paste into my sketh it seems to freeze.
Any suggestion?
holmes4
February 26, 2014, 2:52pm
7
It's not freezing try telling us what it's really doing.
Mark
Hi!
When I start sending info to the serial it just show only the first result... and stops..
How would you know if it is "frozen up", or not ?
Maybe it is your serial connection that is frozen up.
Thats it.. after restarting my PC everything started working!
Just for me to know. Thats the size limit(just in case of a overflow).
Tks a lot..
Check this for flash and SRAM capability
But, you must also know this
You may find this useful: