Pages: [1]   Go Down
Author Topic: How can I change a varible through my menu structure  (Read 830 times)
0 Members and 1 Guest are viewing this topic.
Salem, OR
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How can I set up the code to change these through the menu interface?

Any code samples you have would be a great help to me. I am still learning C++ and this interface for Arduino. My menus are working but I do not have the Integer Variables for (HEAT ON, PRIMARY FAN ON, and SECONDARY FAN ON) called out in my Menu structure yet (type byte, increment 1, values 32 - 99). This is in Fahrenheit. My current code is attached

Thank you for any assistance,

Terry smiley-red

* THERMOSTAT_MENU.ino (12.88 KB - downloaded 15 times.)
Logged

Germany
Offline Offline
Edison Member
*
Karma: 137
Posts: 1548
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe it is better to ask here:
http://arduino.cc/forum/index.php/topic,99693.0

Oliver
Logged

France
Offline Offline
Edison Member
*
Karma: 38
Posts: 1012
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would like to help, but really I don't understand your problem, and most importantly I can't read this code!

I suggest you use: http://indentcode.net smiley

(I prefer the Allman-style indent, but can't find an online tool for this..)
« Last Edit: October 07, 2012, 04:28:44 pm by guix » Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

CTRL+T in the IDE would suffice.

I spotted this: the noButtonPressed() function returns a value:
Code:
int noButtonPressed()
{
    return MW_BTNULL;
}

But when you call it, you just throw it away:
Code:
    if(buttonValue >= 1000)
    {
        buttonPressed = 0;
        noButtonPressed();                   // is calling an extra fucntion
    }

Also as a matter of coding style, I suggest you never omit { and } when writing an if() statement, even if there is only one statement inside that block. It helps code readability and maintainability (i.e. fewer "accidental" bugs).
Logged

Salem, OR
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

All,

It is finished!!!

Thank you for all of your suggestions and patience, I found the error of my ways... placement of the code location and values/calculations I used were incorrect.

Thanks to all!

Cheers,

Terry
Logged

Pages: [1]   Go Up
Jump to: