I would like to help you program the servo motor with Arduino with a button. How can I control the rotation time with timestamp? I need to make the servo motor rotate from -90º to 180º. Thank you!
#include <Servo.h>
Servo servo;
#define pinServo A1
void servolala(){
static unsigned long timestamp;
static byte stateS = 0;
static int angle = 0;
unsigned long timer;
timestamp = millis();
for(angle=0; angle>-90; angle--){
servo.write()
}
switch(state){
case 1:
//continue
}
}
void setup(){
Serial.begin(9600);
pinMode(6, OUTPUT);
pinMode(pinServo, INPUT_PULLUP);
servo.attach(6);
}
void loop(){
servolala();
}"