Unusual Arduino Behavior


I am trying to use my Arduino UNO (R3) to process through a menu function and then do the appropriate actions as selected by the user with simple toggle buttons. A picture of my setup will be included to further understand the design. The Uno module is connected to an LCD display and receives inputs from four buttons wired correctly with pull-up resistors and such. Everything within the system works except for when I try to run additional actions withing the selected menu option ‘Temperature’.

I originally started with simple actions such as lcd.print(“Temperature!”) when you enter the temperature sub-menu and now have moved onto actually reading in a temperature from a 16 bit ADC device. I have designed a function to do this for me and tested everything and it works as it should for reading temperature (separately). For some strange reason when I add to the sub-menu of temperature to actually read in a value, the Uno will not autonomously respond until the right button is depressed. There is no condition anywhere in the code at this code block for such a condition and yet only the right button,not the left or any other button. If I just enter the sub-menu Temperature without pressing any further buttons, just “Temperature!” shows up until the right button (BRight) is depressed.

I will include both my current code and my abbreviated code which can be run and exhibits the same problem at a smaller footprint knowing that other functions are not necessary for this problem. The abbreviated code has as little as necessary to run the menu function and the PC code will be the entire program though not necessary for full understanding.

As a bird’s eye view, there is the Arduino Uno (R3) in the bottom center followed by three breadboards for wiring simplicity and auxiliary functions. Pertaining to this problem, the bottom left board has a black button for the main menu function (BMenu) and the right board has three buttons: Left (BLeft), Select (BSelect), and Right (BRight) from left to right, respectively. The Arduino then outputs a phrase to notify the user of menu changes on the LCD screen. All other components are ancillary to this though are the voltage converter (top right), fan MOSFETs (top left), and 16 bit ADC (center).

I am truly confounded at this problem because the only condition for right button depression is for the menu to cycle through its options. I am wondering if the Arduino is overloaded with functions/variables or are libraries conflicting with each other?

Thank you for any help you may provide!

PC_abbreviated.ino (3.33 KB)

PC.ino (1.19 KB)

It is not so easy to follow but I have noticed this:

  1. It is not clear how your buttons are wired. Is it LOW or HIGH which indicates whether a button is pressed ? Do you have external pullup/pulldown resistors. There is no pinMode() and no software debouncing.

  2. You have 2 variables enterChoice and loops which appear to act as flags and more or less in parallel. why both ?

Does it work as expected if you continuously keep the button "BMenu" pressed while you change the choice and then press the select button ?

A schematic diagram should be included, even hand drawn.


Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html . Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Ops pic.

Thanks.. Tom.. :slight_smile: