Skip to content

touchAttachInterrupt callback not called #5799

Closed
@Johboh

Description

@Johboh

Hardware:

Board: ESP32-S2FN4R2 / S2 Mini
Core Installation version: 2.0.0
IDE name: Arduino 1.8.16
Flash Frequency: 80Mhz
PSRAM enabled: yes
Upload Speed: 921600
Computer OS: Windows 10

Description:

No interrupt callback on touch, but reading touch works as expected.

Sketch

uint16_t threshold = 1500;
bool touchdetected = false;

void gotTouch(){
 touchdetected = true;
}

void setup() {
  Serial.begin(115200);
  delay(1000); // give me time to bring up serial monitor
  Serial.println("ESP32 Touch Interrupt Test");
  touchAttachInterrupt(T5, gotTouch, threshold);
}

void loop(){
  if(touchdetected){
    touchdetected = false;
    Serial.println("Touch detected"); // Never printed
  }
  Serial.println(touchRead(T5));
  delay(200);
}

Serial output

Output when not touching:

1767
1782
1808
1797
1795
1823
1790
1817
1816
1843
1808
1844
1844

output when touching:

949
215
2100
1458
558
1698
2033
97
1098
1715
639
1397
2079
320
762
1883
1003
125
2082
1586
414

Debug Messages:

Sorry, even when enabling Core Debug Level: Debug, nothing additional is written to serial port.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions