Hi, I am in need of some expertise in finishing a ODD or Even gambling game. My game features two 1602 and 4 sanwa style arcade buttons. So far I have accomplished getting the odd or even to print to the first screen using one buttons to roll the dice so to speak and another to reset and start again. After hitting the first button it displays odd or even on the first screen and reset button starts it over. However I am at a loss on how to use other two buttons to pick odd for one button or even for the other button and then have a tally of how many correct guesses or if the house is wining how many incorrect guesses the player is down and have that print to the second screen.
Here is a fritzing of my wiring.
and here is my code so far
#include <LiquidCrystal.h>
#include <JC_Button.h>
const byte Pin_button = (8);
const byte Pin_button2 = (9);
const byte Pin_button3 = (6);
const byte Pin_button4 = (7);
Button BUTTON2 (Pin_button2);
Button BUTTON1 (Pin_button);
Button BUTTON3 (Pin_button3);
Button BUTTON4 (Pin_button4);
long roll;
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
LiquidCrystal lcd2(A5, A4, A3, A2, A1, A0);
void setup() {
BUTTON1.begin();
BUTTON2.begin();
BUTTON3.begin();
BUTTON4.begin();
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.setCursor(0,0);
lcd.print("Welcome Gambler");
lcd.setCursor(0,1);
lcd.print("ODD or EVEN");
lcd2.begin(16, 2);
// Print a message to the LCD.
lcd2.setCursor(0,0);
lcd2.print("Choose Now");
lcd2.setCursor(0,1);
lcd2.print("ODD or EVEN");
}
void loop() {
Checkbuttons();
}
void Checkbuttons(){
BUTTON1.read();
if (BUTTON1.wasReleased()) Roll();
BUTTON2.read();
if (BUTTON2.wasReleased()) reset();
//BUTTON3.read();
//if (BUTTON3.wasReleased()) oneOdd();
// BUTTON4.read();
//if (BUTTON4.wasReleased()) oneEven();
}
void Roll(){
lcd.clear();
roll = random(2);
if (roll == 0){
lcd.print("Even WINS");
}else if (roll == 1){
lcd.print("Odd WINS");
}
}
void reset(){
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Play Again");
lcd.setCursor(0,1);
lcd.print("Place Your Bets");
}
void oneOdd(){
}
void oneEven();{
}
Any help or direction on this would be much appreciated.
