#include TouchSensor touch(D9); // D9 on XIAO int ledPin = D1; // D1 on XIAO void setup() { pinMode(ledPin, OUTPUT); } void loop() { touch.update(); // always call this first if (touch.isTouched()) { digitalWrite(ledPin, HIGH); // LED ON while touching } else { digitalWrite(ledPin, LOW); // LED OFF when not touching } }