Thread: Arduino issues
View Single Post
Old 03-04-13, 02:21 PM   #13
Piwoslaw
Super Moderator
 
Piwoslaw's Avatar
 
Join Date: May 2009
Location: Warsaw, Poland
Posts: 961
Thanks: 188
Thanked 110 Times in 86 Posts
Default

Quote:
Originally Posted by AC_Hacker View Post
I think this is an illegal line... with the minus in front of the equal sign:

Code:
steinhart -= 273.15;
[...]
Compound assignment operators in C and C++

+= plus equal sign

Quote:
Originally Posted by AC_Hacker View Post
The part of the program that is at the top, in other words above...

Code:
void setup()   {
... is where all variable name must be declared, or else the program will not know what the strange undefined words mean.
[...]
I may be wrong (I haven't installed the Arduino compiler on my new computer yet, so I can't try it today), but a variable defined in setup() may not be visible in loop() since those are two distinct functions. If you want a variable to be visible in both setup() and loop(), it must be declared outside of the scope of either function, ie before the declaration of setup() (after the #define would be good).
__________________
Ecorenovation - the bottomless piggy bank that tries to tame the energy hog.
Piwoslaw is offline   Reply With Quote
The Following User Says Thank You to Piwoslaw For This Useful Post:
Mikesolar (03-05-13)