Lesson 10 · Code The Base Motor


Suggested Time: 30-60 minutes

Lesson Plan

Lesson Overview

  • Program the base servo motor
  • Calibrate the base servo motor

Tutorial Video

Sample Code

#include <Servo.h>

//- servos move half a circle 0-180 degrees.
Servo baseMotor;

//- runs only once when you turn on
void setup() {
  baseMotor.attach(6);
}


//- runs forever in a loop after setup
void loop() {
  
  baseMotor.write(0);
  delay(1000);
  baseMotor.write(180);
  delay(1000);
  
}

Additional Resources

Documents

Other