Browse Source

serial debug output

main
Hendrik Langer 8 years ago
parent
commit
acb7b8c741
  1. 3
      README.md
  2. 40
      src/keyboard.cpp
  3. 9
      src/main.cpp

3
README.md

@ -17,8 +17,7 @@ cd soundboard
virtualenv . virtualenv .
source bin/activate source bin/activate
pip install -U platformio pip install -U platformio
platformio run platformio run -t upload && platformio device monitor -b 115200
platformio run -t upload
``` ```
## ToDo ## ToDo

40
src/keyboard.cpp

@ -7,54 +7,34 @@ Keyboard::Keyboard() {
} }
void gotTouch0() { void gotTouch0() {
delay(10); touchDetected[0] = true;
if (touchRead(T0) < threshold[0])
touchDetected[0] = true;
} }
void gotTouch1() { void gotTouch1() {
delay(10); touchDetected[1] = true;
if (touchRead(T1) < threshold[1])
touchDetected[1] = true;
} }
void gotTouch2() { void gotTouch2() {
delay(10); touchDetected[2] = true;
if (touchRead(T2) < threshold[2])
touchDetected[2] = true;
} }
void gotTouch3() { void gotTouch3() {
delay(10); touchDetected[3] = true;
if (touchRead(T3) < threshold[3])
touchDetected[3] = true;
} }
void gotTouch4() { void gotTouch4() {
delay(10); touchDetected[4] = true;
if (touchRead(T4) < threshold[4])
touchDetected[4] = true;
} }
void gotTouch5() { void gotTouch5() {
delay(10); touchDetected[5] = true;
if (touchRead(T5) < threshold[5])
touchDetected[5] = true;
} }
void gotTouch6() { void gotTouch6() {
delay(10); touchDetected[6] = true;
if (touchRead(T6) < threshold[6])
touchDetected[6] = true;
} }
void gotTouch7() { void gotTouch7() {
delay(10); touchDetected[7] = true;
if (touchRead(T7) < threshold[7])
touchDetected[7] = true;
} }
void gotTouch8() { void gotTouch8() {
delay(10); touchDetected[8] = true;
if (touchRead(T8) < threshold[8])
touchDetected[8] = true;
} }
void gotTouch9() { void gotTouch9() {
delay(10); touchDetected[9] = true;
if (touchRead(T9) < threshold[9])
touchDetected[9] = true;
} }
bool Keyboard::getTouchDetected(uint8_t pad) { bool Keyboard::getTouchDetected(uint8_t pad) {

9
src/main.cpp

@ -9,6 +9,7 @@
#include "keyboard.h" #include "keyboard.h"
#define VERSION "0.0"
#define LED_PIN 21 #define LED_PIN 21
Keyboard keyboard; Keyboard keyboard;
@ -18,12 +19,18 @@ void setup()
// initialize LED digital pin as an output. // initialize LED digital pin as an output.
pinMode(LED_PIN, OUTPUT); pinMode(LED_PIN, OUTPUT);
keyboard.init(); keyboard.init();
Serial.begin(115200);
Serial.println("-------------------------------------");
Serial.print("Soundboard v.");
Serial.println(VERSION);
Serial.println("https://dev.xd0.de/hendrik/soundboard");
Serial.println("-------------------------------------");
} }
void loop() void loop()
{ {
bool touched = false; bool touched = false;
for(int i; i<=9; i++) { for(int i=0; i<=9; i++) {
if (keyboard.getTouchDetected(i) == true) { if (keyboard.getTouchDetected(i) == true) {
touched = true; touched = true;
} }

Loading…
Cancel
Save