#include #include /* Convert wireless playstation guitar to USB guitar with Teensy. Copyright (C) 2020 Adam Bissen This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* 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); }