// Button pins
const int RECORDBUTTON = 6;
const int STOPBUTTON = 7;
const int CLEARBUTTON = 8;
const int MODEBUTTON = 9;
const int TRACK1BUTTON = 10;
const int TRACK2BUTTON = 11;
const int TRACK3BUTTON = 12;
const int TRACK4BUTTON = 13;
// LED pins
const int redPin1 = 22;
const int greenPin1 = 23;
const int redPin2 = 24;
const int greenPin2 = 25;
const int redPin3 = 26;
const int greenPin3 = 27;
const int redPin4 = 28;
const int greenPin4 = 29;
int buttonState = 0;
void setup() {
//setup pin modes
pinMode(RECORDBUTTON, INPUT_PULLUP);
pinMode(STOPBUTTON, INPUT_PULLUP);
pinMode(CLEARBUTTON, INPUT_PULLUP);
pinMode(MODEBUTTON, INPUT_PULLUP);
pinMode(TRACK1BUTTON, INPUT_PULLUP);
pinMode(TRACK2BUTTON, INPUT_PULLUP);
pinMode(TRACK3BUTTON, INPUT_PULLUP);
pinMode(TRACK4BUTTON, INPUT_PULLUP);
pinMode(redPin1, OUTPUT);
pinMode(greenPin1, OUTPUT);
pinMode(redPin2, OUTPUT);
pinMode(greenPin2, OUTPUT);
pinMode(redPin3, OUTPUT);
pinMode(greenPin3, OUTPUT);
pinMode(redPin4, OUTPUT);
pinMode(greenPin4, OUTPUT);
}
void loop() {
// Programming MODE BUTTON
buttonState = digitalRead(MODEBUTTON);
if (buttonState == HIGH) {
// Turn LED GREEN:
digitalWrite(greenPin1, HIGH);
digitalWrite(greenPin2, HIGH);
digitalWrite(greenPin3, HIGH);
digitalWrite(greenPin4, HIGH);
} else {
// TURN LED RED:
digitalWrite(greenPin1, LOW);
digitalWrite(greenPin2, LOW);
digitalWrite(greenPin3, LOW);
digitalWrite(greenPin4, LOW);
digitalWrite(redPin1, HIGH);
}
// Programming TRACK BUTTONS IN RECORD MODE
buttonState = digitalRead(TRACK1BUTTON);
if (buttonState == HIGH) {
// SELECT TRACK1, LED RED
digitalWrite(redPin1, HIGH);
} else {
// TURN LED OFF
digitalWrite(redPin1, LOW);
}
buttonState = digitalRead(TRACK2BUTTON);
if (buttonState == HIGH) {
// SELECT TRACK 2, LED RED:
digitalWrite(redPin2, HIGH);
} else {
//
}
// TURN LED OFF
digitalWrite(redPin2, LOW);
}