// Senso v1.00.00 (c)23.11.2023
// 8, 14, 20. 31 Züge (Level 1-4)
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <EEPROM.h>
#define NOTE_B0 31
#define NOTE_C1 33
#define NOTE_CS1 35
#define NOTE_D1 37
#define NOTE_DS1 39
#define NOTE_E1 41
#define NOTE_F1 44
#define NOTE_FS1 46
#define NOTE_G1 49
#define NOTE_GS1 52
#define NOTE_A1 55
#define NOTE_AS1 58
#define NOTE_B1 62
#define NOTE_C2 65
#define NOTE_CS2 69
#define NOTE_D2 73
#define NOTE_DS2 78
#define NOTE_E2 82
#define NOTE_F2 87
#define NOTE_FS2 93
#define NOTE_G2 98
#define NOTE_GS2 104
#define NOTE_A2 110
#define NOTE_AS2 117
#define NOTE_B2 123
#define NOTE_C3 131
#define NOTE_CS3 139
#define NOTE_D3 147
#define NOTE_DS3 156
#define NOTE_E3 165
#define NOTE_F3 175
#define NOTE_FS3 185
#define NOTE_G3 196
#define NOTE_GS3 208
#define NOTE_A3 220
#define NOTE_AS3 233
#define NOTE_B3 247
#define NOTE_C4 262
#define NOTE_CS4 277
#define NOTE_D4 294
#define NOTE_DS4 311
#define NOTE_E4 330
#define NOTE_F4 349
#define NOTE_FS4 370
#define NOTE_G4 392
#define NOTE_GS4 415
#define NOTE_A4 440
#define NOTE_AS4 466
#define NOTE_B4 494
#define NOTE_C5 523
#define NOTE_CS5 554
#define NOTE_D5 587
#define NOTE_DS5 622
#define NOTE_E5 659
#define NOTE_F5 698
#define NOTE_FS5 740
#define NOTE_G5 784
#define NOTE_GS5 831
#define NOTE_A5 880
#define NOTE_AS5 932
#define NOTE_B5 988
#define NOTE_C6 1047
#define NOTE_CS6 1109
#define NOTE_D6 1175
#define NOTE_DS6 1245
#define NOTE_E6 1319
#define NOTE_F6 1397
#define NOTE_FS6 1480
#define NOTE_G6 1568
#define NOTE_GS6 1661
#define NOTE_A6 1760
#define NOTE_AS6 1865
#define NOTE_B6 1976
#define NOTE_C7 2093
#define NOTE_CS7 2217
#define NOTE_D7 2349
#define NOTE_DS7 2489
#define NOTE_E7 2637
#define NOTE_F7 2794
#define NOTE_FS7 2960
#define NOTE_G7 3136
#define NOTE_GS7 3322
#define NOTE_A7 3520
#define NOTE_AS7 3729
#define NOTE_B7 3951
#define NOTE_C8 4186
#define NOTE_C#8 4435
#define NOTE_D8 4699
#define NOTE_DS8 4978
#define SWITCH_RED 2
#define SWITCH_YELLOW 3
#define SWITCH_GREEN 4
#define SWITCH_BLUE 5
#define SWITCH_REPEAT 8
#define LED_RED 12
#define LED_YELLOW 11
#define LED_GREEN 10
#define LED_BLUE 9
#define SPEAKER 6
#define LED 13
#define DISPLAY_ADDRESS 0x3C
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define msgVersion "v1.00"
#define msgCopyright "(c)23.11.2003"
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// Logo 1 119 x 26
const unsigned char LOGO1 [] PROGMEM = { 0x03, 0xfe, 0x00, 0x07, 0xff, 0x01, 0xff, 0x8f, 0xe0, 0x01, 0xff, 0x00, 0x01, 0xff, 0x80, 0x1f, 0xff, 0xc0, 0x1f, 0xff, 0xc1, 0xff, 0xbf, 0xf8, 0x0f, 0xff, 0xe0, 0x0f, 0xff, 0xf0, 0x3f, 0xff, 0xf0, 0x7f, 0xff, 0xe1, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xf8, 0x1f, 0xff, 0xf8, 0x7f, 0xff, 0xf8, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xfc, 0x3f, 0xff, 0xfc, 0x3f, 0xff, 0xfc, 0x7f, 0xff, 0xf8, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xfc, 0x3f, 0xff, 0xfc, 0x7f, 0xff, 0xfe, 0xff, 0x9f, 0xf8, 0xff, 0xdf, 0xf9, 0xff, 0xff, 0xfc, 0x7f, 0xcf,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e, 0xfe, 0x07, 0xf9, 0xff, 0x87, 0xf8, 0xff, 0x83, 0xfc, 0x7f, 0x03, 0xfe, 0x7f, 0xe7, 0xfe, 0xff, 0x0f, 0xf9, 0xff, 0x87, 0xf8, 0xff, 0x83, 0xfc, 0x7f, 0x87, 0xfe, 0x7f, 0xe7, 0xfe, 0xff, 0x9f, 0xf9, 0xff, 0xff, 0xf9, 0xff, 0xc3, 0xfe, 0x7f, 0xcf, 0xfc, 0x7f, 0xff, 0xfe, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xf9, 0xff, 0xc3, 0xfe, 0x7f, 0xff, 0xfc, 0x7f, 0xff, 0xfe, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xf1, 0xff, 0xc3, 0xfe, 0x7f, 0xff, 0xf8, 0x3f, 0xff, 0xfc, 0xff, 0xff, 0xe0, 0x7f, 0xff, 0xf1, 0xff, 0xc3, 0xfe, 0x7f, 0xff, 0xf0, 0x1f, 0xff, 0xf8, 0x3f, 0xff, 0xc0, 0x3f, 0xff, 0xe1, 0xff, 0xc3, 0xfe, 0x1f, 0xff, 0xe0, 0x0f, 0xff, 0xf0, 0x07, 0xfe, 0x00, 0x0f, 0xff, 0x01, 0xff, 0xc3, 0xfe, 0x03, 0xff, 0x00, 0x01, 0xff, 0x80 };
// Logo 2, 81 x 21
const unsigned char LOGO2 [] PROGMEM = { 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0xf0, 0x0f, 0x00, 0x0e, 0x00, 0x00, 0x0f, 0x83, 0x80, 0x00, 0x01, 0xf8, 0x1f, 0x80, 0x1e, 0x00, 0x00, 0x1f, 0x87, 0x80, 0x00, 0x03, 0xf8, 0x3f, 0x80, 0x1e, 0x00, 0x00, 0x1f, 0x07, 0x80, 0x00, 0x03, 0xf8, 0x7f, 0xc0, 0x3e, 0x00, 0x00, 0x1f, 0x0f, 0x80, 0x00, 0x07, 0xf8, 0xff, 0x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 0x0f, 0x03, 0x00, 0x00, 0x7f, 0xe0, 0x00, 0x0f, 0xff, 0x80, 0x03, 0xc0, 0x07, 0x00, 0xf9, 0x87, 0xe0, 0x07, 0xc0, 0x38, 0x00, 0x78, 0x00, 0xe0, 0x06, 0x00, 0x01, 0x81, 0x81, 0x86, 0x30, 0x0c, 0x00, 0x0c, 0x00, 0xc0, 0x00, 0x30, 0x0c, 0x00, 0x01, 0x83, 0x00, 0xc6, 0x30, 0x18, 0x00, 0x06, 0x01, 0x80, 0x00, 0x30, 0x0c, 0x3f, 0xfd, 0xc6, 0x00, 0xc6, 0x38, 0x30, 0x7f, 0x06, 0x01, 0x87, 0xff, 0xb8, 0x18, 0x3f, 0xff, 0xc6, 0x00, 0xc6, 0x38, 0x30, 0xff, 0x83, 0x03, 0x07, 0xff, 0xf8, 0x30, 0x38, 0x03, 0x8c, 0x00, 0x6c, 0x38, 0x60, 0xe0, 0xc1, 0x86, 0x07, 0x00, 0x70, 0x30, 0x70, 0x00, 0x0c, 0xc0, 0x6c, 0x30, 0xc1, 0xc0, 0xc1, 0x86, 0x0e, 0x00, 0x00, 0x60, 0x1f, 0xf0, 0x18, 0x60, 0x6c, 0x30, 0xc1, 0xc0, 0xc1, 0xcc, 0x03, 0xfe, 0x00, 0x60, 0x00, 0x1c, 0x18, 0x60, 0x3c, 0x71, 0x81, 0xc0, 0xc1, 0xcc, 0x00, 0x03, 0x80, 0x60, 0x00, 0x1c, 0x30, 0xe0, 0x38, 0x71, 0x83, 0x80, 0xc1, 0xcc, 0x00, 0x03, 0x80, 0xc0, 0x00, 0x1c, 0x30, 0xf0, 0x18, 0x71, 0x83, 0x80, 0xc1, 0xd8, 0x00, 0x03, 0x80, 0xc0, 0x00, 0x1c, 0x30, 0xf0, 0x18, 0xf3, 0x03, 0x01, 0x83, 0xd8, 0x00, 0x03, 0x80, 0xc1, 0xff, 0xf8, 0x61, 0xd8, 0x00, 0xe3, 0x07, 0x01, 0x83, 0x98, 0x3f, 0xff, 0x00, 0xc1, 0xff, 0xf8, 0x61, 0xd8, 0x00, 0xe3, 0x07, 0x03, 0x07, 0x98, 0x3f, 0xff, 0x00, 0xc1, 0xc0, 0x00, 0x61, 0xcc, 0x01, 0xc3, 0x06, 0x06, 0x0f, 0x18, 0x38, 0x00, 0x00, 0xc3, 0x80, 0x00, 0x63, 0x8c, 0x01, 0xc3, 0x06, 0x0c, 0x1e, 0x18, 0x70, 0x00, 0x00, 0xc3, 0x80, 0xf8, 0x63, 0x8c, 0x03, 0x83, 0x0e, 0x38, 0x3c, 0x18, 0x70, 0x1f, 0x00, 0xc0, 0xff, 0xbc, 0x63, 0x86, 0x07, 0x83, 0x03, 0xe0, 0x78, 0x18, 0x1f, 0xf7, 0x80, 0xc0, 0x00, 0x78, 0x63, 0x86, 0x0f, 0x03, 0x00, 0x01, 0xf0, 0x18, 0x00, 0x0f, 0x00, 0xc0, 0x00, 0x70, 0x63, 0x06, 0x0f, 0x03, 0x00, 0x07, 0xe0, 0x18, 0x00, 0x0e, 0x00, 0x60, 0x03, 0xf0, 0x3f, 0x03, 0x7e, 0x01, 0xc0, 0x1f, 0x80, 0x0c, 0x00, 0x7e, 0x00, 0x3f, 0xff, 0xc0, 0x1f, 0x01, 0xfc, 0x00, 0xff, 0xff, 0x00, 0x07, 0xff, 0xf8, 0x00, 0x07, 0xfe, 0x00, 0x03, 0x00, 0xe0, 0x00, 0x3f, 0xf8, 0x00, 0x00, 0xff, 0xc0, 0x00 };
char randomString0 = 0;
char randomString1 = -1;
char randomString2 = -2;
String completeString = "";
String highscoreName[5] = { };
long highscoreScore[5] = { };
int unsigned highscoreTime = 99999999;
byte displayDimmed = 1;
byte currentScore[5];
byte currentLevel[5];
byte currentTime[5];
byte currentPlayer = 1;
bool switchRepeat = LOW;
bool switchRepeatOld = HIGH;
bool switchRed = LOW;
bool switchRedOld = HIGH;
bool switchYellow = LOW;
bool switchYellowOld = HIGH;
bool switchGreen = LOW;
bool switchGreenOld = HIGH;
bool switchBlue = LOW;
bool switchBlueOld = HIGH;
void setup()
{
pinMode(SWITCH_RED, INPUT_PULLUP);
pinMode(SWITCH_YELLOW, INPUT_PULLUP);
pinMode(SWITCH_BLUE, INPUT_PULLUP);
pinMode(SWITCH_GREEN, INPUT_PULLUP);
pinMode(SWITCH_REPEAT, INPUT_PULLUP);
pinMode(LED, OUTPUT);
pinMode(LED_RED, OUTPUT);
pinMode(LED_YELLOW, OUTPUT);
pinMode(LED_BLUE, OUTPUT);
pinMode(LED_GREEN, OUTPUT);
if(!display.begin(SSD1306_SWITCHCAPVCC, DISPLAY_ADDRESS)) // Prueft, ob das Display korrekt am I2C-Bus angeschlossen ist
{
Serial.begin(115200);
Serial.println(F("SSD1306 Displayfehler!")); // Fehlerausgabe, wenn nicht
while(1)
{
delay(250);
digitalWrite (LED, digitalRead(LED));
}
}
Wire.begin();
Wire.setClock(800000L);
delay(5000);
STARTUP();
pressAnyKey(5000);
SHOW_HIGHSCORES();
pressAnyKey(5000);
//GAME_OVER();
//RED(200);
//ALL_OFF();
//YELLOW(200);
//ALL_OFF();
//GREEN(200);
//ALL_OFF();
//BLUE(200);
//ALL_OFF();
//GAME_OVER();
//ALL_OFF();
//SHOW_SCORE();
}
void loop()
{
makeRandomNumber();
display.clearDisplay();
display.display();
delay(200);
display.setTextColor(WHITE);
display.dim(displayDimmed);
display.setCursor(10, 30);
display.setTextSize(2);
display.print(randomString0);
display.display();
delay(200);
if(digitalRead(SWITCH_REPEAT) != switchRepeatOld)
if(switchRepeat != switchRepeatOld)
switchRepeatOld = switchRepeat;
if(switchRepeat == LOW)
repeatString();
}
void repeatString()
{
}
void pressAnyKey(long waitMilliSeconds)
{
long unsigned timeNow = millis();
while(digitalRead(SWITCH_REPEAT) == LOW || digitalRead(SWITCH_RED) == LOW || digitalRead(SWITCH_YELLOW) == LOW || digitalRead(SWITCH_GREEN) == LOW || digitalRead(SWITCH_BLUE) == LOW)
{
if(millis() >= timeNow + waitMilliSeconds)
break;
}
timeNow = millis();
while(digitalRead(SWITCH_REPEAT) == HIGH && digitalRead(SWITCH_RED) == HIGH && digitalRead(SWITCH_YELLOW) == HIGH && digitalRead(SWITCH_GREEN) == HIGH && digitalRead(SWITCH_BLUE) == HIGH)
{
if(millis() >= timeNow + waitMilliSeconds)
break;
}
}
void makeRandomNumber()
{
randomSeed(analogRead(0));
randomString0 = 49 + char(random(1, 4));
while(randomString0 == randomString2)
randomString0 = 49 + char(random(1, 4));
randomString2 = randomString1;
randomString1 = randomString0;
completeString = completeString + randomString0;
}
void ALL_OFF()
{
noTone(SPEAKER);
digitalWrite(LED_RED, LOW);
digitalWrite(LED_YELLOW, LOW);
digitalWrite(LED_BLUE, LOW);
digitalWrite(LED_GREEN, LOW);
}
void NEW_GAME()
{
ALL_OFF();
digitalWrite(LED_RED, HIGH);
tone(SPEAKER, NOTE_C4);
delay(200);
ALL_OFF();
digitalWrite(LED_YELLOW, HIGH);
tone(SPEAKER, NOTE_E4);
delay(200);
ALL_OFF();
digitalWrite(LED_GREEN, HIGH);
tone(SPEAKER, NOTE_G4);
delay(200);
ALL_OFF();
digitalWrite(LED_BLUE, HIGH);
tone(SPEAKER, NOTE_C5);
delay(400);
ALL_OFF();
digitalWrite(LED_YELLOW, HIGH);
tone(SPEAKER, NOTE_G4);
delay(200);
ALL_OFF();
digitalWrite(LED_BLUE, HIGH);
tone(SPEAKER, NOTE_C5);
delay(600);
ALL_OFF();
completeString = "";
randomString1 = -1;
randomString2 = -2;
}
void RED(int unsigned dur)
{
digitalWrite(LED_RED, HIGH);
tone(SPEAKER, NOTE_C4);
delay(dur);
ALL_OFF();
delay(dur);
}
void YELLOW(int unsigned dur)
{
digitalWrite(LED_YELLOW, HIGH);
tone(SPEAKER, NOTE_A3);
delay(dur);
ALL_OFF();
delay(dur);
}
void BLUE(int unsigned dur)
{
digitalWrite(LED_BLUE, HIGH);
tone(SPEAKER, NOTE_E4);
delay(dur);
ALL_OFF();
delay(dur);
}
void GREEN(int unsigned dur)
{
digitalWrite(LED_GREEN, HIGH);
tone(SPEAKER, NOTE_A4);
delay(dur);
ALL_OFF();
delay(dur);
}
void GAME_OVER()
{
display.clearDisplay();
display.setTextColor(WHITE);
display.dim(displayDimmed);
display.drawBitmap( 10, 20, LOGO3 , 109, 24, WHITE);
display.drawRoundRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 7, WHITE);
display.display();
ALL_OFF();
digitalWrite(LED_BLUE, HIGH);
tone(SPEAKER, NOTE_A4);
delay(100);
ALL_OFF();
digitalWrite(LED_GREEN, HIGH);
tone(SPEAKER, NOTE_G4);
delay(100);
ALL_OFF();
digitalWrite(LED_YELLOW, HIGH);
tone(SPEAKER, NOTE_E4);
delay(100);
ALL_OFF();
digitalWrite(LED_RED, HIGH);
tone(SPEAKER, NOTE_C4);
delay(100);
ALL_OFF();
digitalWrite(LED_BLUE, HIGH);
tone(SPEAKER, NOTE_A3);
delay(100);
ALL_OFF();
digitalWrite(LED_GREEN, HIGH);
tone(SPEAKER, NOTE_G3);
delay(100);
ALL_OFF();
digitalWrite(LED_YELLOW, HIGH);
tone(SPEAKER, NOTE_E3);
delay(100);
ALL_OFF();
digitalWrite(LED_RED, HIGH);
tone(SPEAKER, NOTE_C3);
delay(100);
ALL_OFF();
SHOW_SCORE(currentPlayer);
tone(SPEAKER, NOTE_A1);
for(int i = 0; i < 5; i++)
{
digitalWrite(LED_RED, HIGH);
digitalWrite(LED_YELLOW, HIGH);
digitalWrite(LED_GREEN, HIGH);
digitalWrite(LED_BLUE, HIGH);
delay(100);
digitalWrite(LED_RED, LOW);
digitalWrite(LED_YELLOW, LOW);
digitalWrite(LED_GREEN, LOW);
digitalWrite(LED_BLUE, LOW);
delay(250);
}
ALL_OFF();
}
void STARTUP()
{
display.clearDisplay();
display.setTextColor(WHITE);
display.dim(displayDimmed);
display.drawRoundRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 7, WHITE);
display.drawBitmap( 4, 3, LOGO1 , 119, 26, WHITE);
display.drawBitmap( 24, 31, LOGO2 , 81, 21, WHITE);
display.setCursor(4, 54);
display.setTextSize(1);
display.print(F(msgVersion));
display.print(F(" "));
display.print(F(msgCopyright));
display.display();
}
void SHOW_SCORE(byte player)
{
display.clearDisplay();
display.setTextColor(WHITE);
display.dim(displayDimmed);
display.drawRoundRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 7, WHITE);
display.setTextSize(2);
display.fillRoundRect(3, 3, 122, 22, 5, WHITE);
display.setCursor(29, 7);
display.setTextColor(BLACK);
display.print(F("PUNKTE"));
display.setTextColor(WHITE);
display.setTextSize(1);
display.drawRoundRect(15, 28, 98, 33, 7, WHITE);
display.setCursor(20, 31);
display.print(F("SPIELER: "));
display.print(currentPlayer);
display.setCursor(20, 41);
display.print(F(" LEVEL: "));
display.print(currentLevel[player]);
display.setCursor(20, 51);
display.print(F(" PUNKTE: "));
display.print(currentScore[player]);
display.display();
}
void SHOW_HIGHSCORES()
{
display.clearDisplay();
display.setTextColor(WHITE);
display.dim(displayDimmed);
display.drawRoundRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 5, WHITE);
display.fillRoundRect(3, 3, 122, 11, 7, WHITE);
display.setCursor(29, 7);
display.setTextColor(BLACK);
display.setTextSize(1);
display.setCursor(42, 5);
display.print(F("REKORDE"));
display.setTextColor(WHITE);
for (byte i = 1; i < 6; i++)
{
display.setCursor( 15, 8 + (i * 9));
display.print(i);
display.setCursor( 25, 8 + (i * 9));
display.print(highscoreName[i]);
display.setCursor( 82, 8 + (i * 9));
display.print(highscoreScore[i]);
}
display.display();
}
// Hier wird der Name des aktuellen Instruments aus dem EEProm gelesen
String readStringFromEEPROM(int startAddress)
{
char data[8];
for (int i = 0; i < 15; i++)
data[i] = EEPROM.read(startAddress + i);
return String(data);
}
// Schreibt den Namen des aktuellen Instruments ins PEEprom.
void writeStringToEEPROM(int addrOffset, const String& strToWrite)
{
for (int i = 0; i < 15; i++)
EEPROM.update(addrOffset + i, strToWrite[i]);
}