diff --git a/touchcontroller/src/main.cpp b/touchcontroller/src/main.cpp index 33d13b7..a23284c 100644 --- a/touchcontroller/src/main.cpp +++ b/touchcontroller/src/main.cpp @@ -7,11 +7,14 @@ uint16_t rawIn[INPUTS]; uint16_t countedLow[INPUTS]; //count the times input was below threshold (touched) #define TOUCHTHRESHOLD 1000 //below which value input counts as touched. 00) { + countedLow[i]--; //decrease counter + } } } @@ -70,10 +75,19 @@ void loop() { } + + for (uint8_t i=0;i=COUNTEDLOWTHRESHOLD) { //key pressed/touched + last_output[i]=true; + }else if (countedLow[i]<=COUNTEDLOWTHRESHOLD_OFF) { //key pressed/touched + last_output[i]=false; + } + } + // ## Calculate Byte ## byte newTouch=0; for (uint8_t i=0;i=COUNTEDLOWTHRESHOLD) { //key pressed/touched + if (last_output[i]) { //key pressed/touched newTouch^=1<