#include<ESP32Servo.h>
Servo monServo;
int valeur;
void setup() {
Serial.begin(115200);
//Serial.println(Hello, ESP32!);
pinMode (33,OUTPUT);//borne 33 en sortie
monServo.attach(33);// connection du servo a la borne 33
}
void loop() {valeur=0;
monServo.write(valeur);
delay(1000);
valeur=180;
monServo.write(valeur);
delay(1000);
for(int position=0;position<=180;position++){monServo.write(position);
delay(15);
Serial.println(position);
}
for(int position=180;position>=0;position--){monServo.write(position);
delay(15);
Serial.println(position);
}
}
int valeur;
void setup(){
//put your setup code here to pun once:
Serial.begin(115200);
pinMode(2,OUTPUT);
}
void loop(){
valeur=analogRead(32);
Serial.println(valeur);
analogWrite(2,valeur/16);
delay(500);
}