#include <LiquidCrystal.h> // Include the LCD library
const int buttonPin = 8;
int buttonState = 0;
double moneyCount = 50;
int lastButtonState = LOW;
int tapCount = 0;
unsigned long lastTap = 0;
bool displaySeven = false;
// Initialize the LCD (adjust pins if not using I2C)
LiquidCrystal lcdOne(22, 23, 4, 5, 6, 7);
LiquidCrystal lcdTwo(24, 25, 10, 11, 12, 13);
LiquidCrystal lcdThree(14, 15, 16, 17, 18, 19);
void setup() {
Serial.begin(9600);
Serial.print("£"); // Try direct symbol (works in some IDEs)
Serial.println(moneyCount);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
randomSeed(analogRead(A0));
lcdOne.begin(16, 2); // Set up the LCD's number of columns and rows
lcdTwo.begin(16, 2); // Set up the LCD's number of columns and rows
lcdThree.begin(16, 2); // Set up the LCD's number of columns and rows
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
singleClick();
delay(250);
}
}
void singleClick(){
moneyCount = moneyCount - 1;
Serial.print("£"); // Try direct symbol (works in some IDEs)
Serial.println(moneyCount);
int randomNumOne = random(0, 5);
int randomNumTwo = random(0, 5); // Generates a number between 0-999
int randomNumThree = random(0, 5); // Generates a number between 0-999
lcdOne.clear();
lcdOne.setCursor(0, 1); // Move to 2nd line
lcdOne.print(randomNumOne);
lcdTwo.clear();
lcdTwo.setCursor(0, 1);
lcdTwo.print(randomNumTwo);
lcdThree.clear();
lcdThree.setCursor(0, 1);
lcdThree.print(randomNumThree);
}