Hi,
Im using an L2c display 4x20 and i’m tyring to make a little quiz.
I’d love to make a quiz with 5 questions. If you get the answere right a green led lights up
If you get the second question right a second green led lights up.
If you get the third question wrong a red led lights up.
After 5 questions right i’d like to get '‘congratz you solved the puzzle’'on my screen.
and al green leds are on
Questions could be; what kind of tree is this; Oak or Maple.
Then if you guess Oak and its right; Indeed Oak, on to question 2
And if you choose Maple; Too bad, it is an Oak, try again.
If search a lot of quiz scripts on google but nothing seem to fit for my project
Code is down below and a pic of the schematics here
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2);
boolean buttonLeft;
boolean buttonRight;
void setup()
{
pinMode(8, INPUT); //Rechter knop buttonright
pinMode(9, INPUT); //Linker knop buttonLeft
pinMode(2, OUTPUT); //vraag 1 goed (question 1 right)
pinMode(3, OUTPUT); //vraag 2 goed (question 2 right)
pinMode(4, OUTPUT); //vraag 3 goed (question 3 right)
pinMode(5, OUTPUT); //vraag 4 goed/right (question 4 right)
pinMode(6, OUTPUT); //vraag 5 goed/right(question 5 right)
pinMode(7, OUTPUT); //vraag fout/wrong (question wrong)
lcd.init();
lcd.backlight();
lcd.setCursor(6, 1); //Introduction welcome
lcd.print("Welkom");
lcd.setCursor(2, 2);
lcd.print("beste puzzelaar!");
delay(3000);
lcd.clear();
lcd.setCursor(4, 1);
lcd.print("Tijd voor een");
lcd.setCursor(4, 2);
lcd.print("kleine quiz!");
delay(3000);
lcd.clear();
lcd.setCursor(6, 0);
lcd.print("Ben je er");
lcd.setCursor(5, 1);
lcd.print("klaar voor?");
delay(3000);
lcd.setCursor(7, 2);
lcd.print("3");
delay(500);
lcd.setCursor(8, 2);
lcd.print(".");
delay(500);
lcd.setCursor(9, 2);
lcd.print(".");
delay(500);
lcd.print("2");
delay(500);
lcd.setCursor(10, 2);
lcd.setCursor(11, 2);
lcd.print(".");
delay(500);
lcd.setCursor(12, 2);
lcd.print(".");
delay(500);
lcd.setCursor(13, 2);
lcd.print("1");
delay(1000);
lcd.clear();
}
void loop()
{
buttonLeft = digitalRead(13); // Button A
buttonRight = digitalRead(2); //Button B