Pages: [1]   Go Down
Author Topic: Variables out of control!  (Read 956 times)
0 Members and 1 Guest are viewing this topic.
Moss
Offline Offline
Full Member
***
Karma: 1
Posts: 119
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi again all,

I am trying to combine two of my sketches that work well alone, and the combination is not that complicated. The strange thing is that it works from time to time, but then suddenly one or all three variables for the temperatures are lost, indicating anything from -1500 deg C to 3000 deg C! The variables are locked inside an if and a switch case, declared as 0 and updated every 10 mins from a serial event, but suddenly they are out of control. It doesn't sound like a memory thing to me.
Has anyone seen anything similar, in general terms?
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It doesn't sound like a memory thing to me.
Does to me.  Classic buffer overrun bug.
Logged

Moss
Offline Offline
Full Member
***
Karma: 1
Posts: 119
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You were right. I moved an array into a function (was not needed outside) and it worked. It's easier to find the fault when you know what to look for...
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
You were right
Don't be so surprised.  It's been known to happen occasionally.   smiley-wink
Logged

Pages: [1]   Go Up
Jump to: