const int button = 13;
const int led = 2;
int count = 0;
int newcount;
#include <ESP32Servo.h>
const int servoPin = 12;
Servo servo;
void setup()
{
servo.attach(servoPin, 500, 2400);
Serial.begin(115200);
Serial.println("Hello you!");
pinMode(button, INPUT_PULLUP);
pinMode(led, OUTPUT);
}
void loop()
{
int buttonState = digitalRead(button);
if (buttonState == LOW)
{
newcount=count+1;
digitalWrite(led, !digitalRead(led));
Serial.print("pressed ");
Serial.println(newcount);
servo.write(count);
delay(250);
count=newcount;
}
if(count >=179)
{
count=0;
}
}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
servo1:GND
servo1:V+
servo1:PWM