The children in the school were very surprised to see a bird come out and flick the switch back. A lot of them couldn’t figure out what was in the box, and were intrigued by that. Some even opened the lid of the box to see what was inside.
Most of the children stayed around 2 minutes, and then got disinterested. However, there were around 5 children who were really fascinated, and they stayed for over 10 minutes just flicking the switch and observing. It felt really good to see smiles on their faces, and I would say the Useless Bird Box was a success!
Here is the video for the demo. Turn on sound for chirps!
// demo use of a library, hobby servo output //fix hinge //bird head //speaker //birdhouse #include <Servo.h> Servo hi; Servo op; void setup() { hi.attach(8); op.attach(2); pinMode(A2,INPUT); Serial.begin(9600); } void loop() { hi.write(90);//80 op.write(60); int lol=analogRead(A2); Serial.println(lol); int ran=random(1,40); //normal if (ran<=10) { if (lol>900) { delay(500); op.write(35); delay(500); hi.write(65); delay(500); hi.write(90); delay(500); } }else if (ran<=20){ //screech if (lol>900) { delay(500); op.write(35); delay(500); //done opening hi.write(80);//moves up for (int i=1; i<=10; i++){ delay(100); hi.write(75); delay(100); hi.write(80); } //shakes //sounds for (int a=1;a<=3;a++){ for (int i=4000;i<=4200;) { tone(12, i); i=i+10; delay(5); Serial.println(i); } noTone(12); delay(300); } hi.write(90); delay(500); hi.write(65);//close delay(500); hi.write(90); delay(500); } }else if (ran<=30){ if (lol>900) { delay(500); op.write(45); delay(500); //sound for (int a=1;a<=4;a++){ for (int i=4000;i<=4200;) { tone(12, i); i=i+10; delay(5); Serial.println(i); } noTone(12); delay(500); } } } else{ if (lol>900) { delay(500); op.write(35); delay(500); //sound for (int a=1;a<=2;a++){ for (int i=4000;i<=4200;) { tone(12, i); i=i+10; delay(5); Serial.println(i); } noTone(12); delay(500); } for (int j=90;j>=70;j--) { hi.write(j); delay(50); } hi.write(90); delay(500); hi.write(65);//closes delay(500); hi.write(90); delay(500); } } }
Leave a Reply
You must be logged in to post a comment.