Hot answers tagged

3

When you want to perform actions in response to button presses, you should take care of reacting to the signal edges rather than levels. In other words, you perform the action only when the signal changes from LOW to HIGH, not every time you see it HIGH. You should also read about button bounce, and either implement your own debouncing or use an existing ...


1

Displaying Kanji or Chinese characters is way beyond the ability of an LCD that displays 5 pixel by 7 pixel characters. To understand the limitations, take a piece of graph paper and draw out a set of 5x7 rectangles. See if you can define ANY recognizable Japanese or Chinese characters on your graph paper. Maybe a couple of characters? (Then again, maybe not....


1

Michael has already given you some excellent advice on how to clean up your code. Your switch statement does not make much sense. You're switching based on an out-of-range index into an array of constants. Once you've read the states of all your buttons as outlined by Michael, your loop needs to decide what to do about the state of each switch. Is this a ...


1

Next time align your code with ctrl-K (after selecting). And yes, you can heavily optimize your code (for maintainability) using arrays: Instead of const int buttonPin1 = 2; const int buttonPin2 = 3; const int buttonPin3 = 4; const int buttonPin4 = 5; const int buttonPin5 = 6; use const int buttonPins[] = { 2, 3, 4, 5, 6 }; In software engineering it's ...


Only top voted, non community-wiki answers of a minimum length are eligible