I was sitting at my kitchen table wishing I had some cookies and was suddenly inspired to program my servo to dunk them in milk for me. I created the contraption and couldn’t find any cookies, so instead I attached a teabag and used the setup to bob the tea bag up and down so the tea is brewed more fully than with a static bag.

 

 


#include <Servo.h>
Servo servo;

void setup() {
Serial.begin(9600);
servo.attach(9);
servo.write(0);
}

void loop() {
for(int pos=0; pos<=90; pos++){
servo.write(pos);
delay(20);
}
for(int pos=90; pos>=0; pos--){
servo.write(pos);
delay(20);
}
}