Things used in this project

Code

CodePlain text
// Written by Simone Giertz

#include <Servo.h> 
 
Servo servo[3];  
// base, upper arm, lower arm
static const int servoPin[3] = {7,8,6};
 
void setup() 
{ 
  Serial.begin(9600);
  for(int i=0; i<3; i++){ 
    servo[i].attach(servoPin[i]); 
  }
  // Fold the robot arm at the top of the helmet
  servo[0].write(90); // base
  servo[1].write(30);  // upper arm
  servo[2].write(150);  // lower arm

} 
 
void loop() 
{ 
   // Wait five seconds before we start the toothbrushing
   delay(5000);
   
   // Put the arm in brushing position
   servo[1].write(180);
   servo[0].write(90);
   servo[2].write(70);
   
   delay(1000);
   
   // brush back and forth
   for(int i = 0; i<10; i++){
    servo[2].write(60);
    delay(200);
    servo[2].write(120);
    delay(200);
   }
   
   // Fold the robot arm back up
   servo[0].write(90);
   servo[1].write(30);
   servo[2].write(150);
}

Credits

10296386 10154132421980570 7885147228332876326 o
Simone
8 projects • 110 followers
Freelancing Creative Technologist. @simonegiertz
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog