top of page
ROBOT MAGIC
CHAPTER THREE: Make a Motor Move
Copy + Paste this code to your Arduino Sketch:
#include <Servo.h>
Servo servo; //Change the name from "servo"
//to whatever you want!
void setup(){
servo.attach(8); // Here we tell the Arduino
// which pin # "servo" is attached to
}
void loop() {
delay(1000); // Delay just means WAIT! Remember every
// 1000 = 1 second!
servo.write(180); // Move servo to 180 degrees!
delay(1000); // Wait 1 second
servo.write(0); // Move servo to 0 degree
delay(1000);
}
bottom of page