debug output prints

This commit is contained in:
interfisch 2022-01-15 13:04:58 +01:00
parent 8abdd3c2f9
commit 28b1b2784d
1 changed files with 16 additions and 10 deletions

View File

@ -10,7 +10,8 @@ uint16_t countedLow[INPUTS]; //count the times input was below threshold (touche
// Inputdelay is given by: COUNTEDLOWTHRESHOLD*ADCREADINTERVAL
unsigned long last_adcmicros=0;
#define ADCREADINTERVAL 2000 //in microseconds. interval to read all adc values
//#define ADCREADINTERVAL 2000 //in microseconds. interval to read all adc values
#define ADCREADINTERVAL 20000 //in microseconds. interval to read all adc values
unsigned long last_send=0;
#define MINIMUMSENDDELAY 10 //in milliseconds. minimum delay between serial sends
@ -19,14 +20,14 @@ void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
pinMode(A5, INPUT);
pinMode(A6, INPUT);
pinMode(A7, INPUT);
pinMode(A0, INPUT_PULLUP);
pinMode(A1, INPUT_PULLUP);
pinMode(A2, INPUT_PULLUP);
pinMode(A3, INPUT_PULLUP);
pinMode(A4, INPUT_PULLUP);
pinMode(A5, INPUT_PULLUP);
pinMode(A6, INPUT_PULLUP);
pinMode(A7, INPUT_PULLUP);
Serial.begin(115200);
}
@ -50,6 +51,11 @@ void loop() {
//Serial.print(": ");
//Serial.println(micros()-mic);
Serial.print(rawIn[1]);
Serial.print(", ");
Serial.print(rawIn[1]);
Serial.println();
for (uint8_t i=0;i<INPUTS;i++){ //for all inputs
if (rawIn[i]<=TOUCHTHRESHOLD) { //touch detected (input low at this sample)
countedLow[i]++; //increase counter
@ -83,7 +89,7 @@ void loop() {
touchOut=newTouch; //update
last_send=loopmillis;
//Serial.println(touchOut, BIN); //Debug output
Serial.write(touchOut); //Send byte
//Serial.write(touchOut); //Send byte
}
}