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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #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); } } |
Leave a Reply
You must be logged in to post a comment.