97 lines
1.5 KiB
C++
97 lines
1.5 KiB
C++
#include <Chrono.h>
|
|
#include <LightChrono.h>
|
|
|
|
/*
|
|
Need 3.3V supply to touch controls. Voltage feedback for each section
|
|
#Whammy Bar. 3.3V supply to pot
|
|
|
|
Inputs:
|
|
D6 Strum Up
|
|
D5 Strum Down
|
|
D0 Green Button
|
|
D1 Red Button
|
|
D2 Yellow Button
|
|
D3 Blue Button
|
|
D4 Orange Button
|
|
A1 Slider Bar
|
|
Whammy Bar - Analog
|
|
Start Select
|
|
Up
|
|
Down
|
|
Left
|
|
Right
|
|
|
|
Outputs:
|
|
LED's
|
|
22
|
|
23
|
|
|
|
*/
|
|
int ledState = LOW;
|
|
Chrono ledTimer;
|
|
|
|
void setup() {
|
|
|
|
Serial.begin(9600); // USB is always 12 Mbit/sec
|
|
// analogReadAveraging(8);
|
|
pinMode(0, INPUT_PULLUP);
|
|
pinMode(1, INPUT_PULLUP);
|
|
pinMode(2, INPUT_PULLUP);
|
|
pinMode(3, INPUT_PULLUP);
|
|
pinMode(4, INPUT_PULLUP);
|
|
pinMode(5, INPUT_PULLUP);
|
|
pinMode(6, INPUT_PULLUP);
|
|
pinMode(23, OUTPUT);
|
|
digitalWrite(23, ledState);
|
|
pinMode(22, OUTPUT);
|
|
digitalWrite(23, !ledState);
|
|
|
|
}
|
|
|
|
//int slider = 0;
|
|
|
|
void loop() {
|
|
|
|
// slider = analogRead(1);
|
|
|
|
// Serial.println(slider);
|
|
// delay(500);
|
|
|
|
if (digitalRead(0) == LOW ) {
|
|
Serial.println("Green");
|
|
}
|
|
|
|
if (digitalRead(1) == LOW ) {
|
|
Serial.println("Red");
|
|
}
|
|
|
|
if (digitalRead(2) == LOW ) {
|
|
Serial.println("Yellow");
|
|
}
|
|
|
|
if (digitalRead(3) == LOW ) {
|
|
Serial.println("Blue");
|
|
}
|
|
|
|
if (digitalRead(4) == LOW ) {
|
|
Serial.println("Orange");
|
|
}
|
|
|
|
if (digitalRead(5) == LOW ) {
|
|
Serial.println("Strum Up");
|
|
}
|
|
|
|
if (digitalRead(6) == LOW ) {
|
|
Serial.println("Strum Down");
|
|
}
|
|
|
|
if(ledTimer.hasPassed(500)) {
|
|
ledTimer.restart();
|
|
digitalWrite(23, !ledState);
|
|
digitalWrite(22, ledState);
|
|
ledState = !ledState;
|
|
}
|
|
|
|
// delay(500);
|
|
}
|