#include "pwmWrite.h" //library for servo in xiao esp32 Pwm pwm = Pwm(); //kind of signal to send const int servoPin5 = D5; //attacht servo const int touchsens = D4; //attacht tocuh void setup() { pinMode(touchsens,INPUT); //set touch sensor as input } void loop() { int position; // position in degrees int val = digitalRead(touchsens); //save the value of touch sensor if (val == HIGH){ //if pressed for (position = 0; position <= 180; position += 30) { pwm.writeServo(servoPin5, position); //specify the kind of signal where to send delay(500); } } }