Go Down

Topic: How can I change a varible through my menu structure (Read 858 times) previous topic - next topic

tlhurley

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:

olikraus

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

Oliver

guix

#2
Oct 07, 2012, 11:20 pm Last Edit: Oct 07, 2012, 11:28 pm by guix Reason: 1
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 :)

(I prefer the Allman-style indent, but can't find an online tool for this..)

tuxduino

CTRL+T in the IDE would suffice.

I spotted this: the noButtonPressed() function returns a value:
Code: [Select]

int noButtonPressed()
{
    return MW_BTNULL;
}


But when you call it, you just throw it away:
Code: [Select]

    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).

tlhurley

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

Go Up