Hello guys, I am Nick and welcome once again to educ8s.tv a channel/blog that is all about DIY electronics projects with Arduino, Raspberry Pi, ESP8266 and other popular boards.
In today’s tutorial, we are going learn how to build our own menu for the popular Nokia 5110 LCD display, which has the ability to make our projects more user-friendly and more capable. We will be using an Arduino Uno today but you can obviously use any other Arduino board. Stefan, a friend from Germany, asked for this project, and I believe everyone can benefit from it so here it is!
Arduino Nokia 5110 Menu
The goal behind the operation of the project is simple, When the device is turned on, a simple menu appears, and with the help of three buttons, we will be able to navigate through the menu with buttons for up, down and to select a menu item. The first option in the menu is to set the Contrast of the display. By selecting the first option a new UI screen will be displayed and by pressing the up and down buttons we can change the contrast of the display. If we press the middle button again, we go back to the main UI screen.
The second menu item in the main UI screen helps to turn the backlight of the display on or off. Selecting it by pressing the middle button turns the backlight of the display on or off. Lastly, if we navigate to the last menu item we can reset the settings for the display to the default values.
This project is just a demonstration to show what is possible as regards a putting a menu on the Nokia 5110 LCD Display, you can modify the project to fit into your own more complex project’s, menu requirement.
That’s it for introduction, Let’s now see how to build this project.
Required Components/parts and Where to Buy
The parts listed below are needed in order to build this project and can be bought by clicking on the link in front of each part.
Arduino Uno ▶  https://educ8s.tv/part/ArduinoUno
Nokia 5110 LCD ▶ https://educ8s.tv/part/NOKIA5110
Small Breadboard ▶ https://educ8s.tv/part/SmallBreadboard
Buttons ▶ https://educ8s.tv/part/Buttons
Jumper Wires ▶ https://educ8s.tv/part/JumperWires
Wires ▶ https://educ8s.tv/part/Wires
Full disclosure: All of the links above are affiliate links. I get a small percentage of each sale they generate. Thank you for your support!
[adsense]
Schematics
While we have done a lot of tutorials on this website to cover several things around the Nokia 5110 LCD display, like how to load your own custom graphics on the display which can be found at this link (https://www.youtube.com/watch?v=aDwrMeu4k9Y), for visitors and those who would want to check out the connection again, connect the components/parts as shown in the schematics below.
The pin connections of the LCD to the Arduino as implemented in the schematics is described below to make it easy to follow.
LCD ▶ Arduino Pin 1(RST) ▶ D12 Pin 2(CE) ▶ D11 Pin 3(DC) ▶ D10 Pin 4(DIN) ▶ D9 Pin 5(CLK) ▶ D8 Pin 6(VCC) ▶ VCC Pin 7(LIGHT) ▶ D7 Pin 8(GND) ▶ GND
As you can see from the schematics that the pushbuttons are connected without a resistor, check out this tutorial (https://youtu.be/VtZvf5T98FI) on how to connect your pushbuttons without resistors. It is assumed that the connection between the switches and the Arduino is seamless but if you do get stuck anywhere do feel free to reach out via the comment section, I will be happy to help.
Code
The code of the Arduino Nokia 5110 Menu tutorial is complex but I will do my best to explain it. You will get a basic understanding of how the code works but if you want to fully understand it you have to make your own menu and see exactly how it works. Let’s start.
For this project, we will be using two libraries from Adafruit to allow us easily communicate with the LCD while writing the code. You can find links for both libraries below and also in the description of the video.
——————–
LIBRARIES
——————–
? Adafruit GFX: https://github.com/adafruit/Adafruit-GFX-Library
? Nokia 5110: https://github.com/adafruit/Adafruit-PCD8544-Nokia-5110-LCD-library
We are going to skip the explanation of the basic part of the code, those can be gotten from other tutorials that involve the Nokia 5110 LCD like the one at this link.
The first thing we do as usual is to include the libraries that we will be using after which we declare the variables that will be used to represent the buttons and other data.
#include <Adafruit_GFX.h> #include <Adafruit_PCD8544.h> boolean backlight = true; int contrast=50; int menuitem = 1; int page = 1; volatile boolean up = false; volatile boolean down = false; volatile boolean middle = false; int downButtonState = 0; int upButtonState = 0; int selectButtonState = 0; int lastDownButtonState = 0; int lastSelectButtonState = 0; int lastUpButtonState = 0;
Next, we move to the void setup function where we turn on the pull-up resistors that allow us to use the push buttons without a resistor and also initialize the serial monitor and our display.
void setup() { pinMode(2, INPUT_PULLUP); pinMode(1, INPUT_PULLUP); pinMode(0, INPUT_PULLUP); pinMode(7,OUTPUT); digitalWrite(7,LOW); //Turn Backlight ON Serial.begin(9600); display.begin(); display.setContrast(contrast); //Set contrast to 50 display.clearDisplay(); display.display(); }
After the void setup, we proceed to the void loop function. The most important part of the void loop function is calling the drawMenu function and taking actions based on the status of the pushbuttons. The drawMenu function is responsible for drawing the Menu on the display and is called every few milliseconds, so if there is a change on the menu this function is responsible for updating the menu on the screen.
void loop() { drawMenu(); downButtonState = digitalRead(2); selectButtonState = digitalRead(1); upButtonState = digitalRead(0); checkIfDownButtonIsPressed(); checkIfUpButtonIsPressed(); checkIfSelectButtonIsPressed(); if (up && page == 1 ) { up = false; menuitem--; if (menuitem==0) { menuitem=3; } }else if (up && page == 2 ) { up = false; contrast--; setContrast(); } if (down && page == 1) { down = false; menuitem++; if (menuitem==4) { menuitem=1; } }else if (down && page == 2 ) { down = false; contrast++; setContrast(); } if (middle) { middle = false; if (page == 1 && menuitem==2) { if (backlight) { backlight = false; turnBacklightOff(); } else { backlight = true; turnBacklightOn(); } } if(page == 1 && menuitem ==3) { resetDefaults(); } else if (page == 1 && menuitem==1) { page=2; } else if (page == 2) { page=1; } } }
There are also two very important global variables, the variable page, and the variable menuitem. The variable page remembers which UI screen is currently being displayed on the screen. So, if the page variable is 1, we are in the main UI screen, and if the variable is 2 we are in the Contrast UI screen. The menu item remembers the selected menu item. So, if its value is 1, the first menu item is selected, so the drawMenu function must draw this menu item as black with white letters. If the menu item is 2 the second menu item is selected and so on.
The full code for the project is available for download below.
——————–
CODE OF THE PROJECT
——————–
That’s it for this tutorial, thanks for watching and reading. You can show support by dropping comments here and subscribing to our channel on youtube.
——————–
SUBSCRIBE ON YOUTUBE
——————–
Never miss a video: Subscribe to educ8s.tv[/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]
Hi Nick
Fantastic project.
I’m trying use this as a base for my project. But i’m using a 12C 128,68 oled. I’m having problems in trying to add sub-menus.
home page
item- on /off
item -on/off
item -on/off
menu2
item -on/off
item -on/off
item -on/off
return home
Kind regards, Michael
hi michael
Did you alredy found the solution? Beacouse i have the same problem :)
Hi Nick,
is it possible to make a similar video with all these menus with button interaction for the 0.96 oled display?
http://www.banggood.com/0_96-Inch-4Pin-Blue-Yellow-IIC-I2C-OLED-Display-Module-For-Arduino-p-969144.html?rmmds=search
thanks in advance.
with regards, Luis
Who can show this project’s connection diagram? Who can show which pins on the screen are connected to where?
Nick.
is it possible to add an page 3 with sub menu I have tray it the code compiled good but it does not work.
I will like to have an main page with “SETTING”
“set Alarm1” > on off
“set Alarm2” > on off
“set GPS” > on off
etc
love your code.
SINGLE BUTTON VERSION (1 CLICK = DOWN; DOUBLE CLICK = SELECT; LONG CLICK = UP)
#include
#include
#include
// Software SPI (slower updates, more flexible pin options):
// pin 13 – Serial clock out (SCLK)
// pin 11 – Serial data out (DIN)
// pin 9 – Data/Command select (D/C)
// pin 10 – LCD chip select (CS)
// pin 8 – LCD reset (RST)
Adafruit_PCD8544 display = Adafruit_PCD8544(13, 11, 9, 10, 8);
boolean backlight = true;
int contrast = 57;
int menuitem = 1;
int page = 1;
volatile boolean up = false;
volatile boolean down = false;
volatile boolean middle = false;
/* 4-Way Button: Click, Double-Click, Press+Hold, and Press+Long-Hold Test Sketch
By Jeff Saltzman
Oct. 13, 2009
To keep a physical interface as simple as possible, this sketch demonstrates generating four output events from a single push-button.
1) Click: rapid press and release
2) Double-Click: two clicks in quick succession
3) Press and Hold: holding the button down
4) Long Press and Hold: holding the button for a long time
*/
#define buttonPin 4
//=================================================
void setup() {
// Set button input pin
pinMode(buttonPin, INPUT_PULLUP);
pinMode(2, OUTPUT);
digitalWrite(2, LOW); //Turn Backlight ON at startup
//Serial.begin(9600);
display.begin();
display.setContrast(contrast); //Set contrast to 50
display.clearDisplay();
display.display();
}
void loop() {
drawMenu();
if (up && page == 1 ) {
up = false;
menuitem–;
if (menuitem == 0)
{
menuitem = 3;
}
} else if (up && page == 2 ) {
up = false;
contrast–;
setContrast();
}
if (down && page == 1) {
down = false;
menuitem++;
if (menuitem == 4)
{
menuitem = 1;
}
} else if (down && page == 2 ) {
down = false;
contrast++;
setContrast();
}
if (middle) {
middle = false;
if (page == 1 && menuitem == 2)
{
if (backlight)
{
backlight = false;
turnBacklightOff();
}
else
{
backlight = true;
turnBacklightOn();
}
}
if (page == 1 && menuitem == 3)
{
resetDefaults();
}
else if (page == 1 && menuitem == 1) {
page = 2;
}
else if (page == 2) {
page = 1;
}
}
// Get button event and act accordingly
int b = checkButton();
if (b == 1) clickEvent();
if (b == 2) doubleClickEvent();
if (b == 3) holdEvent();
if (b == 4) longHoldEvent();
}
//=================================================
// Events to trigger
void clickEvent() {
down = ! down;
}
void doubleClickEvent() {
middle = ! middle;
}
void holdEvent() {
up = ! up;
}
void longHoldEvent() {
}
//=================================================
// MULTI-CLICK: One Button, Multiple Events
// Button timing variables
int debounce = 20; // ms debounce period to prevent flickering when pressing or releasing the button
int DCgap = 250; // max ms between clicks for a double click event
int holdTime = 1000; // ms hold period: how long to wait for press+hold event
int longHoldTime = 3000; // ms long hold period: how long to wait for press+hold event
// Button variables
boolean buttonVal = HIGH; // value read from button
boolean buttonLast = HIGH; // buffered value of the button’s previous state
boolean DCwaiting = false; // whether we’re waiting for a double click (down)
boolean DConUp = false; // whether to register a double click on next release, or whether to wait and click
boolean singleOK = true; // whether it’s OK to do a single click
long downTime = -1; // time the button was pressed down
long upTime = -1; // time the button was released
boolean ignoreUp = false; // whether to ignore the button release because the click+hold was triggered
boolean waitForUp = false; // when held, whether to wait for the up event
boolean holdEventPast = false; // whether or not the hold event happened already
boolean longHoldEventPast = false;// whether or not the long hold event happened already
int checkButton() {
int event = 0;
buttonVal = digitalRead(buttonPin);
// Button pressed down
if (buttonVal == LOW && buttonLast == HIGH && (millis() – upTime) > debounce)
{
downTime = millis();
ignoreUp = false;
waitForUp = false;
singleOK = true;
holdEventPast = false;
longHoldEventPast = false;
if ((millis() – upTime) debounce)
{
if (not ignoreUp)
{
upTime = millis();
if (DConUp == false) DCwaiting = true;
else
{
event = 2;
DConUp = false;
DCwaiting = false;
singleOK = false;
}
}
}
// Test for normal click event: DCgap expired
if ( buttonVal == HIGH && (millis() – upTime) >= DCgap && DCwaiting == true && DConUp == false && singleOK == true && event != 2)
{
event = 1;
DCwaiting = false;
}
// Test for hold
if (buttonVal == LOW && (millis() – downTime) >= holdTime) {
// Trigger “normal” hold
if (not holdEventPast)
{
event = 3;
waitForUp = true;
ignoreUp = true;
DConUp = false;
DCwaiting = false;
//downTime = millis();
holdEventPast = true;
}
// Trigger “long” hold
if ((millis() – downTime) >= longHoldTime)
{
if (not longHoldEventPast)
{
event = 4;
longHoldEventPast = true;
}
}
}
buttonLast = buttonVal;
return event;
}
void drawMenu()
{
if (page == 1)
{
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“MAIN MENU”);
display.drawFastHLine(0, 10, 83, BLACK);
display.setCursor(0, 15);
if (menuitem == 1)
{
display.setTextColor(WHITE, BLACK);
}
else
{
display.setTextColor(BLACK, WHITE);
}
display.print(“>Contrast”);
display.setCursor(0, 25);
if (menuitem == 2)
{
display.setTextColor(WHITE, BLACK);
}
else
{
display.setTextColor(BLACK, WHITE);
}
display.print(“>Light: “);
if (backlight)
{
display.print(“ON”);
}
else
{
display.print(“OFF”);
}
display.display();
if (menuitem == 3)
{
display.setTextColor(WHITE, BLACK);
}
else
{
display.setTextColor(BLACK, WHITE);
}
display.setCursor(0, 35);
display.print(“>Reset”);
display.display();
}
else if (page == 2)
{
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“CONTRAST”);
display.drawFastHLine(0, 10, 83, BLACK);
display.setCursor(5, 15);
display.print(“Value”);
display.setTextSize(2);
display.setCursor(5, 25);
display.print(contrast);
display.setTextSize(2);
display.display();
}
}
void resetDefaults()
{
contrast = 50;
setContrast();
backlight = true;
turnBacklightOn();
}
void setContrast()
{
display.setContrast(contrast);
display.display();
}
void turnBacklightOn()
{
digitalWrite(2, LOW);
}
void turnBacklightOff()
{
digitalWrite(2, HIGH);
}
Cool! Thank you very much for sharing!
Thanks to you, I solved my problem.
Hello I have a problem. When i pressed the Select Button, the lcd screen is empty and does not comeback to the Menu. I can’t fix it. Some any help, Please!
I fix it up!. Some problems with Arduino Pins. I don’t know why, but is already now.
tuve que agregar esta linea
#include
ademas cambiar esta linea
Adafruit_PCD8544 display = Adafruit_PCD8544(5, 4, 3);
por esta otra
Adafruit_PCD8544 display = Adafruit_PCD8544(13,11,5, 4, 3);
tuve que agregar esta linea
#include
ademas cambiar esta linea
Adafruit_PCD8544 display = Adafruit_PCD8544(5, 4, 3);
por esta otra
Adafruit_PCD8544 display = Adafruit_PCD8544(13,11,5, 4, 3);
don’t set 13 and 11, because if you set those two the lib will use software SPI…
If any of you have a problem with SPI (hardware) using port 13 chk 11 as DIN, you have to set port 10 to a OUTPUT.
pinMode(10, OUTPUT);
thanks for the tutorial
For everyone who have problems with the buttons, you can better not use port 0 and 1 for input, because they also used bij your USB for serial communication on the uno.
i have changed to
pinMode(10, OUTPUT); //hardware spi
pinMode(8, INPUT_PULLUP); // down button
pinMode(9, INPUT_PULLUP); // up button
pinMode(2, INPUT_PULLUP); //select button
pinMode(7,OUTPUT); // light
in loop:
downButtonState = digitalRead(8);
selectButtonState = digitalRead(2);
upButtonState = digitalRead(9);
you can better define your ports, you can easier move them around if needed…
I hope this will help you all with problem… i have tested it on 2 nokia5110 devices from china and the code works fine…
Very helpful tutorial thank you.
I used your code to get me started and then like a good book, I couldn’t put it down.
I added bit’s and changed bits and it’s an entirely different beast now.
I hooked up a DHT11 Temp and Humidity sensor, an LDR sensor and I modified how the buttons were read allowing both multiple select and hold down for scroll.
With the three buttons there are now 7 options:
Left, Center, Right, Left & Center, Center & Right, Left & Right and finally Left, Center & Right)
(For instance from any screen pressing all three buttons at once will bring you back to the main menu)
Then I added and changed all the menus.
I moved all of your original options under a submenu “Display” and added “Sensors” & “Play Game” menu items.
I added a page for the LDR sensor and another for the T & H sensor and a final “Blank” one.
I then added all the pages to interface with three random games (I didn’t code the games, sorry, I might do them but I only did this while procrastinating on doing my FYP)
I also left a lot of the button options empty I really have to get back to my FYP but everything is boiler plated.
I had so much fun playing with this and it was your tutorial that got it started so thank you.
I will include the code in the next post but be warned it ended up being 1300 lines.
#include
#include
#include
// The pin numbers for the arduino pins
// mapped to human readable names
# define LCD_RST 3
# define LCD_CE 4
# define LCD_DC 5
# define LCD_DIN 11
# define LCD_CLK 13
# define LCD_LIGHT 7
# define BTN_LEFT 6
# define BTN_CENTER 8
# define BTN_RIGHT 9
//# define LED_BIT_ONE 12
//# define LED_BIT_TWO 10
//# define LED_BIT_THREE 2
# define DHT11_PIN 2
# define SENSOR_LDR A0
// Common states mapped to human readable names
# define BTN_PRESSED LOW
# define LED_ON HIGH
# define LED_OFF LOW
# define ZERO 0
// The values for the possible page
// numbers mapped to human readable names
# define PG_HOME 1
# define PG_DISPLAY 2
# define PG_CONTRAST 3
# define PG_GAME_MENU 4
# define PG_SENSOR_MENU 5
# define PG_SNAKE_GAME 6
# define PG_PONG_GAME 7
# define PG_MACCA_GAME 8
# define PG_SENSOR_MENU_LDR 9
# define PG_SENSOR_MENU_TEMP_HUMID 10
# define PG_SENSOR_MENU_ITEM3 11
# define PG_SNAKE_GAME_PLAY 12
# define PG_SNAKE_GAME_HIGHSCORES 13
# define PG_SNAKE_GAME_RESET 14
# define PG_PONG_GAME_PLAY 15
# define PG_PONG_GAME_HIGHSCORES 16
# define PG_PONG_GAME_RESET 17
# define PG_MACCA_GAME_PLAY 18
# define PG_MACCA_GAME_HIGHSCORES 19
# define PG_MACCA_GAME_RESET 20
// The combinational values for the possible button
// presses mapped to human readable names
# define BTN_CMB_LEFT 1
# define BTN_CMB_CENTER 2
# define BTN_CMB_RIGHT 4
# define BTN_CMB_LEFT_CENTER 3
# define BTN_CMB_CENTER_RIGHT 6
# define BTN_CMB_LEFT_RIGHT 5
# define BTN_CMB_LEFT_CENTER_RIGHT 7
// Human readable values for the menu options
# define HOME_ITEM_MIN 1
# define HOME_ITEM_DISPLAY 1
# define HOME_ITEM_SENSORS 2
# define HOME_ITEM_PLAY_GAME 3
# define HOME_ITEM_MAX 3
# define DISPLAY_ITEM_MIN 1
# define DISPLAY_ITEM_CONTRAST 1
# define DISPLAY_ITEM_LIGHT 2
# define DISPLAY_ITEM_RESET 3
# define DISPLAY_ITEM_MAX 3
# define SENSORS_ITEM_MIN 1
# define SENSORS_ITEM_LDR 1
# define SENSORS_ITEM_TEMP_HUMID 2
# define SENSORS_ITEM_ITEM3 3
# define SENSORS_ITEM_MAX 3
# define GAMES_ITEM_MIN 1
# define GAMES_ITEM_SNAKE 1
# define GAMES_ITEM_PONG 2
# define GAMES_ITEM_MACCA 3
# define GAMES_ITEM_MAX 3
# define GAMES_SNAKE_ITEM_MIN 1
# define GAMES_SNAKE_ITEM_PLAY 1
# define GAMES_SNAKE_ITEM_HIGHSCORES 2
# define GAMES_SNAKE_ITEM_RESET 3
# define GAMES_SNAKE_ITEM_MAX 3
# define GAMES_PONG_ITEM_MIN 1
# define GAMES_PONG_ITEM_PLAY 1
# define GAMES_PONG_ITEM_HIGHSCORES 2
# define GAMES_PONG_ITEM_RESET 3
# define GAMES_PONG_ITEM_MAX 3
# define GAMES_MACCA_ITEM_MIN 1
# define GAMES_MACCA_ITEM_PLAY 1
# define GAMES_MACCA_ITEM_HIGHSCORES 2
# define GAMES_MACCA_ITEM_RESET 3
# define GAMES_MACCA_ITEM_MAX 3
// Human readable default values
# define DEFAULT_CONTRAST 50
boolean backlight = true;
// Variables declared as volatile to ensure they
// wont be optomised out of the code
volatile int btnCombo = 0;
volatile int homeItem = 1;
volatile int displayItem = 1;
volatile int sensorsItem = 1;
volatile int gamesItem = 1;
volatile int gamesSnakeItem = 1;
volatile int gamesPongItem = 1;
volatile int gamesMaccaItem = 1;
volatile int page = 1;
volatile int contrast = DEFAULT_CONTRAST;
Adafruit_PCD8544 display = Adafruit_PCD8544(LCD_CLK, LCD_DIN, LCD_DC, LCD_CE, LCD_RST);
dht DHT;
void setup() {
pinMode(LCD_RST, OUTPUT);
pinMode(LCD_CE, OUTPUT);
pinMode(LCD_DC, OUTPUT);
pinMode(LCD_DIN, OUTPUT);
pinMode(LCD_CLK, OUTPUT);
pinMode(LCD_LIGHT, OUTPUT);
digitalWrite(LCD_LIGHT,LOW); //Turn Backlight ON
pinMode(BTN_LEFT, INPUT);
digitalWrite(BTN_LEFT, HIGH);
pinMode(BTN_CENTER, INPUT);
digitalWrite(BTN_CENTER, HIGH);
pinMode(BTN_RIGHT, INPUT);
digitalWrite(BTN_RIGHT, HIGH);
pinMode(DHT11_PIN, INPUT);
digitalWrite(DHT11_PIN, HIGH);
pinMode(SENSOR_LDR, INPUT);
//pinMode(LED_BIT_ONE, OUTPUT);
//pinMode(LED_BIT_TWO, OUTPUT);
//pinMode(LED_BIT_THREE, OUTPUT);
Serial.begin(9600);
display.begin();
display.setContrast(contrast); //Set contrast to 50
display.clearDisplay();
display.display();
}
void loop() {
btnCombo = whichIfAnyButtonsPressed();
//testingLeds(btnCombo);
switch(page) {
case PG_HOME:
homeOperations(btnCombo);
drawHome();
break;
case PG_DISPLAY:
displayOperations(btnCombo);
drawDisplay();
break;
case PG_CONTRAST:
contrastOperations(btnCombo);
drawContrast();
break;
case PG_GAME_MENU:
gameOperations(btnCombo);
drawGame();
break;
case PG_SENSOR_MENU:
sensorOperations(btnCombo);
drawSensor();
break;
case PG_SNAKE_GAME:
snakeOperations(btnCombo);
drawSnake();
break;
case PG_PONG_GAME:
pongOperations(btnCombo);
drawPong();
break;
case PG_MACCA_GAME:
maccaOperations(btnCombo);
drawMacca();
break;
case PG_SENSOR_MENU_LDR:
sensorsLdrOperations(btnCombo);
drawSensorLdr();
break;
case PG_SENSOR_MENU_TEMP_HUMID:
sensorsTempAndHumidOperations(btnCombo);
drawSensorTempAndHumid();
break;
case PG_SENSOR_MENU_ITEM3:
sensorsItem3Operations(btnCombo);
drawSensorItem3();
break;
case PG_SNAKE_GAME_PLAY:
snakePlayOperations(btnCombo);
drawSnakePlay();
break;
case PG_SNAKE_GAME_HIGHSCORES:
snakeHighScoresOperations(btnCombo);
drawSnakeHigScores();
break;
case PG_SNAKE_GAME_RESET:
snakeResetOperations(btnCombo);
drawSnakeReset();
break;
case PG_PONG_GAME_PLAY:
pongPlayOperations(btnCombo);
drawPongPlay();
break;
case PG_PONG_GAME_HIGHSCORES:
pongHighScoresOperations(btnCombo);
drawPongHigScores();
break;
case PG_PONG_GAME_RESET:
pongResetOperations(btnCombo);
drawPongReset();
break;
case PG_MACCA_GAME_PLAY:
maccaPlayOperations(btnCombo);
drawMaccaPlay();
break;
case PG_MACCA_GAME_HIGHSCORES:
maccaHighScoresOperations(btnCombo);
drawMaccaHigScores();
break;
case PG_MACCA_GAME_RESET:
maccaResetOperations(btnCombo);
drawMaccaReset();
break;
}
}
void homeOperations(int homeButton) {
switch(homeButton) {
case BTN_CMB_LEFT: // Up
homeItem–;
if (homeItem HOME_ITEM_MAX) {
homeItem = HOME_ITEM_MIN;
}
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
page = PG_DISPLAY;
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
page = PG_SENSOR_MENU;
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
page = PG_GAME_MENU;
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = GAMES_ITEM_SNAKE;
break;
}
}
void displayOperations(int displayButton) {
switch(displayButton) {
case BTN_CMB_LEFT: // Up
displayItem–;
if (displayItem DISPLAY_ITEM_MAX) {
displayItem = DISPLAY_ITEM_MIN;
}
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
page = PG_HOME;
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void contrastOperations(int contrastButton) {
switch(contrastButton) {
case BTN_CMB_LEFT: // Up
contrast–;
setContrast();
break;
case BTN_CMB_CENTER: // Select
page = PG_DISPLAY;
break;
case BTN_CMB_RIGHT: // Down
contrast++;
setContrast();
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void sensorOperations(int sensorButton) {
switch(sensorButton) {
case BTN_CMB_LEFT: // Up
sensorsItem–;
if (sensorsItem SENSORS_ITEM_MAX) {
sensorsItem = SENSORS_ITEM_MIN;
}
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void gameOperations(int gameMenuButton) {
switch(gameMenuButton) {
case BTN_CMB_LEFT: // UP
gamesItem–;
if (gamesItem GAMES_ITEM_MAX) {
gamesItem = GAMES_ITEM_MIN;
}
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
page = PG_HOME;
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
page = PG_PONG_GAME;
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
page = PG_MACCA_GAME;
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void snakeOperations(int snakeButton) {
switch(snakeButton) {
case BTN_CMB_LEFT: // UP
gamesSnakeItem–;
if (gamesSnakeItem GAMES_ITEM_MAX) {
gamesSnakeItem = GAMES_ITEM_MIN;
}
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
page = PG_GAME_MENU;
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void snakePlayOperations(int snakeButton) {
switch(snakeButton) {
case BTN_CMB_LEFT: // Up
break;
case BTN_CMB_CENTER: // Select
break;
case BTN_CMB_RIGHT: // Down
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void snakeHighScoresOperations(int snakeButton) {
switch(snakeButton) {
case BTN_CMB_LEFT: // Up
break;
case BTN_CMB_CENTER: // Select
break;
case BTN_CMB_RIGHT: // Down
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void snakeResetOperations(int snakeButton) {
switch(snakeButton) {
case BTN_CMB_LEFT: // Up
break;
case BTN_CMB_CENTER: // Select
break;
case BTN_CMB_RIGHT: // Down
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void pongOperations(int pongButton) {
switch(pongButton) {
case BTN_CMB_LEFT: // UP
gamesPongItem–;
if (gamesPongItem GAMES_ITEM_MAX) {
gamesPongItem = GAMES_ITEM_MIN;
}
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
page = PG_GAME_MENU;
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void pongPlayOperations(int snakeButton) {
switch(snakeButton) {
case BTN_CMB_LEFT: // Up
break;
case BTN_CMB_CENTER: // Select
break;
case BTN_CMB_RIGHT: // Down
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void pongHighScoresOperations(int snakeButton) {
switch(snakeButton) {
case BTN_CMB_LEFT: // Up
break;
case BTN_CMB_CENTER: // Select
break;
case BTN_CMB_RIGHT: // Down
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void pongResetOperations(int snakeButton) {
switch(snakeButton) {
case BTN_CMB_LEFT: // Up
break;
case BTN_CMB_CENTER: // Select
break;
case BTN_CMB_RIGHT: // Down
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void maccaOperations(int maccaButton) {
switch(maccaButton) {
case BTN_CMB_LEFT: // UP
gamesMaccaItem–;
if (gamesMaccaItem GAMES_ITEM_MAX) {
gamesMaccaItem = GAMES_ITEM_MIN;
}
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
page = PG_GAME_MENU;
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void maccaPlayOperations(int snakeButton) {
switch(snakeButton) {
case BTN_CMB_LEFT: // Up
break;
case BTN_CMB_CENTER: // Select
break;
case BTN_CMB_RIGHT: // Down
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void maccaHighScoresOperations(int snakeButton) {
switch(snakeButton) {
case BTN_CMB_LEFT: // Up
break;
case BTN_CMB_CENTER: // Select
break;
case BTN_CMB_RIGHT: // Down
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void maccaResetOperations(int snakeButton) {
switch(snakeButton) {
case BTN_CMB_LEFT: // Up
break;
case BTN_CMB_CENTER: // Select
break;
case BTN_CMB_RIGHT: // Down
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void sensorsLdrOperations(int sensorsLdrButton) {
switch(sensorsLdrButton) {
case BTN_CMB_LEFT: // Up
page = PG_HOME;
break;
case BTN_CMB_CENTER: // Select
break;
case BTN_CMB_RIGHT: // Down
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
page = PG_SENSOR_MENU;
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void sensorsTempAndHumidOperations(int sensorsTempAndHumidButton) {
switch(sensorsTempAndHumidButton) {
case BTN_CMB_LEFT: // Up
page = PG_HOME;
break;
case BTN_CMB_CENTER: // Select
break;
case BTN_CMB_RIGHT: // Down
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
page = PG_SENSOR_MENU;
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
void sensorsItem3Operations(int sensorsItem3Button) {
switch(sensorsItem3Button) {
case BTN_CMB_LEFT: // Up
break;
case BTN_CMB_CENTER: // Select
break;
case BTN_CMB_RIGHT: // Down
break;
case BTN_CMB_LEFT_CENTER: // Up and Select
page = PG_SENSOR_MENU;
break;
case BTN_CMB_CENTER_RIGHT: // Down and Select
break;
case BTN_CMB_LEFT_RIGHT: // Up and Down
break;
case BTN_CMB_LEFT_CENTER_RIGHT: // Up, Select and Down
page = PG_HOME;
break;
}
}
int whichIfAnyButtonsPressed() {
int btnCmbValue = ZERO;
if(digitalRead(BTN_LEFT) == BTN_PRESSED) {
btnCmbValue += BTN_CMB_LEFT;
}
if(digitalRead(BTN_CENTER) == BTN_PRESSED) {
btnCmbValue += BTN_CMB_CENTER;
}
if(digitalRead(BTN_RIGHT) == BTN_PRESSED) {
btnCmbValue += BTN_CMB_RIGHT;
}
delay(100);
return btnCmbValue;
}
void drawHome() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“MAIN MENU”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
if(homeItem == HOME_ITEM_DISPLAY) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>Display”);
display.setCursor(0, 25);
if(homeItem == HOME_ITEM_SENSORS) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>Sensors”);
display.setCursor(0, 35);
if(homeItem == HOME_ITEM_PLAY_GAME) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>Play Game”);
display.display();
}
void drawDisplay() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“DISPLAY”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
if(displayItem == DISPLAY_ITEM_CONTRAST) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>Contrast”);
display.setCursor(0, 25);
if(displayItem == DISPLAY_ITEM_LIGHT) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>Light: “);
if(digitalRead(LCD_LIGHT) == LOW) {
display.print(“ON”);
} else {
display.print(“OFF”);
}
display.display();
if(displayItem == DISPLAY_ITEM_RESET) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.setCursor(0, 35);
display.print(“>Reset”);
display.display();
}
void drawContrast() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“CONTRAST”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(5, 15);
display.print(“Value”);
display.setTextSize(2);
display.setCursor(5, 25);
display.print(contrast);
display.setContrast(contrast);
display.setTextSize(2);
display.display();
}
void drawSensor() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“SENSORS”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
if(sensorsItem == SENSORS_ITEM_LDR) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>Ldr”);
display.setCursor(0, 25);
if(sensorsItem == SENSORS_ITEM_TEMP_HUMID) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>TempAndHumid”);
display.display();
if(sensorsItem == SENSORS_ITEM_ITEM3) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.setCursor(0, 35);
display.print(“>Item3”);
display.display();
}
void drawGame() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“GAMES”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
if(gamesItem == GAMES_ITEM_SNAKE) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>Snake”);
display.setCursor(0, 25);
if(gamesItem == GAMES_ITEM_PONG) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>Pong”);
display.display();
if(gamesItem == GAMES_ITEM_MACCA) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.setCursor(0, 35);
display.print(“>Macca”);
display.display();
}
void drawSnake() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“SNAKE”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
if(gamesSnakeItem == GAMES_SNAKE_ITEM_PLAY) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>Play”);
display.setCursor(0, 25);
if(gamesSnakeItem == GAMES_SNAKE_ITEM_HIGHSCORES) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>High Scores”);
display.setCursor(0, 35);
if(gamesSnakeItem == GAMES_SNAKE_ITEM_RESET) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>Reset”);
display.display();
}
void drawSnakePlay() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“PLAY”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
display.display();
}
void drawSnakeHigScores() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“HIGHSCORES”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
display.display();
}
void drawSnakeReset() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“RESET”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
display.display();
}
void drawPong() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“PONG”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
if(gamesPongItem == GAMES_PONG_ITEM_PLAY) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>Play”);
display.setCursor(0, 25);
if(gamesPongItem == GAMES_PONG_ITEM_HIGHSCORES) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>High Scores”);
display.setCursor(0, 35);
if(gamesPongItem == GAMES_PONG_ITEM_RESET) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>Reset”);
display.display();
}
void drawPongPlay() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“PLAY”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
display.display();
}
void drawPongHigScores() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“HIGHSCORES”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
display.display();
}
void drawPongReset() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“RESET”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
display.display();
}
void drawMacca() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“MACCA”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
if(gamesMaccaItem == GAMES_MACCA_ITEM_PLAY) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>Play”);
display.setCursor(0, 25);
if(gamesMaccaItem == GAMES_MACCA_ITEM_HIGHSCORES) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>High Scores”);
display.setCursor(0, 35);
if(gamesMaccaItem == GAMES_MACCA_ITEM_RESET) {
display.setTextColor(WHITE, BLACK);
} else {
display.setTextColor(BLACK, WHITE);
}
display.print(“>Reset”);
display.display();
}
void drawMaccaPlay() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“PLAY”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
display.display();
}
void drawMaccaHigScores() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“HIGHSCORES”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
display.display();
}
void drawMaccaReset() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“RESET”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
display.display();
}
void drawSensorLdr() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“LDR Value”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
display.print(“Light: “);
display.print(analogRead(SENSOR_LDR));
display.setCursor(0, 25);
display.print(“Voltage: “);
display.print((analogRead(SENSOR_LDR)/1024.0)*4.5);
display.display();
delay(1000);
}
void drawSensorTempAndHumid() {
int chk = DHT.read11(DHT11_PIN);
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“Climate”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
display.print(“Temp: “);
display.print(DHT.temperature);
display.print((char)223);
display.setCursor(0, 25);
display.print(“Rel Humidity: “);
display.setCursor(0, 35);
display.print(DHT.humidity);
display.print(“%”);
display.display();
delay(1000);
}
void drawSensorItem3() {
display.setTextSize(1);
display.clearDisplay();
display.setTextColor(BLACK, WHITE);
display.setCursor(15, 0);
display.print(“ITEM3”);
display.drawFastHLine(0,10,83,BLACK);
display.setCursor(0, 15);
display.display();
}
void resetDefaults() {
contrast = DEFAULT_CONTRAST;
setContrast();
digitalWrite(LCD_LIGHT, HIGH);
homeItem = HOME_ITEM_MIN;
displayItem = DISPLAY_ITEM_MIN;
sensorsItem = SENSORS_ITEM_MIN;
gamesItem = GAMES_ITEM_MIN;
gamesSnakeItem = GAMES_SNAKE_ITEM_MIN;
gamesPongItem = GAMES_PONG_ITEM_MIN;
gamesMaccaItem = GAMES_MACCA_ITEM_MIN;
}
void setContrast() {
display.setContrast(contrast);
display.display();
}
The three libraries at the top didn’t load, I think it was because of the angle brackets, so I’ll try again with double quotes.
#include “dht.h”
#include “Adafruit_GFX.h”
#include “Adafruit_PCD8544.h”
I’ve reviewed the code in the post and there is several pieces missing (I used less than and greater than and I think the comment browser treats these as comments.
I might see if I can “guess” a way to upload it, failing that I am happy to post the .ino file if there is a way to do that.
/
Hello Dave. i am interested in your code. i had copied it before and debuged most of the errors that i was able to see. but i am still stuck on one
gamesMaccaItem -;
——-
# define GAMES_ITEM_MAX 3
^
\Arduino\Game_menu\Game_menu.ino\Game_menu.ino.ino:571:26: note: in expansion of macro ‘GAMES_ITEM_MAX’
if (gamesMaccaItem GAMES_ITEM_MAX) {
^
exit status 1
expected primary-expression before ‘;’ token
would it be okay if i asked for the code and you if you may can email it to me at, gbetromero2010 at gmail dot com
thanks in advance
There are many pieces of the project missing, hope you can re-upload it!
Guys,
Please a little help
I have my first Arduino MEGA 256 and I’m trying to replicate this projects, to learn something
Can someone give the corresponding wire connection.
I made the connection from tutorial but nothing on display :(
Thanks in advance
it says display is not declared in this scope plz fix