Back to Parent

void shake(){
for(k = 0; k < 10; k++){
    for(Pos = 0; Pos < 45; Pos += 5) // servo goes from 0 degrees to 180 degrees
   {         // in steps of 1 degree
   myServo.write(Pos);    // tell servo to go to position in
            // variable 'pos'
   delay(15);      // waits 15ms for the servo to reach
            // the position
   }
   for(Pos = 45; Pos>=1; Pos-=5)  // goes from 180 degrees to 0 degrees
   {
   myServo.write(Pos);    // tell servo to go to position in
            // variable 'pos'
   delay(15);      // waits 15ms for the servo to reach
            // the position
   }
 }
}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0