#include <SoftwareSerial.h>
int taste1 = LOW;
int taste1Alt = LOW;
int taste2 = LOW;
int taste2Alt = LOW;
int taste3 = LOW;
int taste3Alt = LOW;
int taste4 = LOW;
int taste4Alt = LOW;
int taste5 = LOW;
int taste5Alt = LOW;
int taste6 = LOW;
int taste6Alt = LOW;
void setup() {
Serial1.begin(31250);
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
}
void loop(){
taste1 = digitalRead(2);
taste2 = digitalRead(3);
taste3 = digitalRead(4);
taste4 = digitalRead(5);
taste5 = digitalRead(6);
taste6 = digitalRead(7);
//=============================================================================
// Taster 1 abfragen --> nur blaues Licht, Scanner nach unten gerichtet Overlay 3!
//=============================================================================
if (taste1 == HIGH && taste1Alt == LOW) {
delay(10);
Serial1.write(144); // note on, Kanal 1
Serial1.write(68); // Note 68 - Overlay 3
Serial1.write(127);
taste1Alt = taste1;
}
if (taste1 == LOW && taste1Alt == HIGH) {
delay(10);
Serial1.write(128); // note off, Kanal 1
Serial1.write(68); // Note 68 - Overlay 3
Serial1.write(127);
taste1Alt = taste1;
}
//=============================================================================
// Taster 2 abfragen --> Hazer (Taster gedrückt halten) Overlay 5!
//=============================================================================
if (taste2 == HIGH && taste2Alt == LOW) {
delay(10);
Serial1.write(144); // note on, Kanal 1
Serial1.write(70); // Note 70 - Overlay 5
Serial1.write(127);
delay(10);
Serial1.write(128); // note off, Kanal 1
Serial1.write(70);
Serial.write(127);
taste2Alt = taste2;
}
if (taste2 == LOW && taste2Alt == HIGH) {
delay(10);
Serial1.write(144); // note on, Kanal 1
Serial1.write(70); // Note 70 - Overlay 5
Serial1.write(127);
delay(10);
Serial1.write(128); // note off, Kanal 1
Serial1.write(70);
Serial.write(127);
taste2Alt = taste2;
}
//==============================================================================
// Taster 3 abfragen --> weißes Strobo-Licht mit grünen Scanner-Licht Overlay 2!
//==============================================================================
if (taste3 == HIGH && taste3Alt == LOW) {
delay(10);
Serial1.write(144); // note on, Kanal 1
Serial1.write(67); // Note 67 - Overlay 2
Serial1.write(127);
delay(10);
Serial1.write(128); // note off, Kanal 1
Serial1.write(67);
Serial.write(127);
taste3Alt = taste3;
}
if (taste3 == LOW && taste3Alt == HIGH) {
delay(10);
Serial1.write(144); // note on, Kanal 1
Serial1.write(67); // Note 67 - Overlay 2
Serial1.write(127);
delay(10);
Serial1.write(128); // note off, Kanal 1
Serial1.write(67);
Serial.write(127);
taste3Alt = taste3;
}
//=============================================================================
// Taster 4 abfragen --> "Blinder" (Taster gedrückt halten) Overlay 4!
//=============================================================================
if (taste4== HIGH && taste4Alt == LOW) {
delay(10);
Serial1.write(144); // note on, Kanal 1
Serial1.write(69); // Note 69 - Overlay 4
Serial1.write(127);
delay(10);
Serial1.write(128); // note off, Kanal 1
Serial1.write(69);
Serial.write(127);
taste4Alt = taste4;
}
if (taste4 == LOW && taste4Alt == HIGH) {
delay(10);
Serial1.write(144); // note on, Kanal 1
Serial1.write(69); // Note 69 - Overlay 4
Serial1.write(127);
delay(10);
Serial1.write(128); // note off, Kanal 1
Serial1.write(69);
Serial.write(127);
taste4Alt = taste4;
}
//=============================================================================
// Taster 5 abfragen --> Strobo (Taster gedrückt halten) Overlay 6!
//=============================================================================
if (taste5 == HIGH && taste5Alt == LOW) {
delay(10);
Serial1.write(144); // note on, Kanal 1
Serial1.write(71); // Note 71 - Overlay 6
Serial1.write(127);
delay(10);
Serial1.write(128); // note off, Kanal 1
Serial1.write(71);
Serial.write(127);
taste5Alt = taste5;
}
if (taste5 == LOW && taste5Alt == HIGH) {
delay(10);
Serial1.write(144); // note on, Kanal 1
Serial1.write(71); // Note 71 - Overlay 6
Serial1.write(127);
delay(10);
Serial1.write(128); // note off, Kanal 1
Serial1.write(71);
Serial.write(127);
taste5Alt = taste5;
}
//=============================================================================
// Taster 6 abfragen --> Blackout FERTIG
//=============================================================================
if (taste6 == HIGH && taste6Alt == LOW) {
delay(10);
Serial1.write(144); // note on, Kanal 1
Serial1.write(84); // Note 84 - Blackout
Serial1.write(127);
taste6Alt = taste6;
}
if (taste6 == LOW && taste6Alt == HIGH) {
delay(10);
Serial1.write(128); // note off, Kanal 1
Serial1.write(84); // Note 84 - Blackout
Serial1.write(127);
taste6Alt = taste6;
}
}