How to rotate the servo motor using Arduino and a button? What would be the function?

2

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();
}"
    
asked by anonymous 19.12.2017 / 18:13

0 answers