/*
Despliega en un color específico al momento de tocar un pin (touch) y
otro al momento de no tocar el pin touch explicando como llegaste al
resultado.
*/
int redPin = 15;
int bluePin = 4;
int greenPin = 2;
const int touchPin = 14;
int pins[] = {redPin, greenPin, bluePin};
void setup() {
for(int i = 0; i < 3; i++) {
pinMode(pins[i], OUTPUT);
}
Serial.begin(9600);
}
void loop() {
int touchDraw = touchRead(touchPin);
Serial.println(touchDraw);
if(touchDraw > 50) {
digitalWrite(pins[0], HIGH);
digitalWrite(pins[1], LOW);
digitalWrite(pins[2], LOW);
} else {
digitalWrite(pins[0], LOW);
digitalWrite(pins[1], HIGH);
digitalWrite(pins[2], LOW);
}
}