0

I am using a Wemos Pro ESP32 development board and would like to be able to use all ten of the available capacitive touch inputs. I am able to get readings from nine of them but not T1. Here is the pin diagram for the board I have.

Wemos Pro ESP32 pins

Running this code on my board produces no difference in reading for T1...

#define numTouchPins 10
byte touchPins[] = { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 };
byte touch[10] = {};

void setup() {
    Serial.begin(115200);
    delay(1000);
}

void loop() {
    for( byte pin = 0; pin < numTouchPins; ++ pin ) {
        touch[pin] = touchRead( touchPins[pin] );  
    }
    for( byte i = 0; i < 10; ++i ) {
        Serial.print( touch[i] );    
        Serial.print( "\t" );
    }
    Serial.println();
}

So the reason for this is that T1 is on GPIO0 which is also connected to a button labeled 0 on the board. Now I realise this is needed in order to select between the ROM serial bootloader mode and the normal execution mode... But, is there a way to change the pinmode from digital-in to touch-in once normal boot has completed? Is there something I can write in the Arduino setup() method that would make this pin behave like the other touch pins?

1

is there a way to change the pinmode from digital-in to touch-in once normal boot has completed?

You already are. However it will make no difference since that pin is connected to external hardware - namely the button and a pullup resistor.

You cannot have touch inputs connected to anything else. The only way to get the touch to work on that input is to physically remove the pullup resistor and even maybe the button. Touch inputs are "touchy" about what else is connected since even a button that's not connected to anything else can effect the capacitance on the pin.

| improve this answer | |
  • 1
    Ok. So you can't use Touch1 on GPIO0 because of this hardware setup ... but can you set it to be usable on another pin? In this hackaday article they talk about an internal multiplexer allowing you to map one pin's functionality to another's ... Any idea how that would be done? – juliusbangert Aug 4 '17 at 15:44
  • No clue whatsoever. Probably not possible with analog pins - that kind of functionality is usually only for moving things like UART, SPI, etc. – Majenko Aug 4 '17 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.