Friday, August 9, 2024

Servo at different angle (Sunil)

 #include <Servo.h>


Servo myServo;  // Create a servo object


void setup() {

  myServo.attach(9);  // Attach the servo to pin 9

}


void loop() {

  myServo.write(30);  // Rotate to 30 degrees

  delay(1000);        // Wait for a second


  myServo.write(60);  // Rotate to 60 degrees

  delay(1000);        // Wait for a second


  myServo.write(90);  // Rotate to 90 degrees

  delay(1000);        // Wait for a second


  myServo.write(120);  // Rotate to 120 degrees

  delay(1000);         // Wait for a second


  myServo.write(180);  // Rotate to 180 degrees

  delay(1000);         // Wait for a second

}


No comments:

Post a Comment

MUD Three Mode operation Manual Automatic GPS

 Code for three mode operation: /*   3-Mode Headlight Controller   - Manual mode (driver uses a toggle to pick high/low)   - Auto mode (LDR...