This may be a silly question, so sorry in advance. I used to be very good at C a long time ago, but haven't used it in about a decade. Slowly getting back into thanks to Arduino.
- I have TWO momentary push buttons which I need to use to control two different aspects of a program - display mode and alert mode. Display mode reads a temperature sensor and each mode converts the value into various formats (F, C, F&C, min/max). Alert mode simply turns on various outputs (display only, LED, buzzer, LED & Buzzer).
I have two problems. I can obviously get one button to operate properly and toggle through the various modes in EITHER the display modes OR the alert modes. However, I can not figure out how to monitor two separate buttons. If I use two Switch statements, the program only sees the first switch statement and seems to ignore the second. I have tried to put both switch statements into various loops, but I just can't figure out how to get this to work. I suppose I could use just ONE button to switch between all the various modes, but I don't want to have to press a button 20 times to get to the correct mode.
I have one button connected to digital 0, and one connected to digital 1. How can I have the program monitor both buttons and react accordingly depending on which is pressed? I would need one button to control one aspect of the program, and the second to update another aspect of the program. The user would press either button at random (i.e. - the user wouldn't necessarily press the first button and then the second, nor would they have to press the second button first then the first.)
- The second problem is that once in the switch statement, the sensor does not update within the code. I have put the code in the case statements, I have put the code within loops within the case statements, I have done everything I can think of. If I go through all the modes, each case switch (button press) WILL update the sensor reading once, but it does not continuously update multiple times per second as it does when NOT in a switch statement just in the regular loop(). Any insight into this issue???
Thank you all in advance!!