Jingle Bells

Sparki get festive! Here is the code to make Sparki “sing” his very own rendition of jingle bells using the piezo buzzer:

#include
void setup(){
sparki.servo(60);
sparki.RGB(RGB_RED);
sparki.clearLCD();
delay(2000);
sparki.drawString(10,2,"Merry");
sparki.drawString(10,4,"Christmas");
sparki.updateLCD();
delay(2000);
}
void loop(){
sparki.moveLeft(30);
sparki.moveRight(30);
for (int i = 0; i < 2; i=i+1)
{
sparki.beep(400, 250);
delay(330);//jin
sparki.beep(400, 250);
delay(330);//gle
sparki.beep(400, 450);
delay(530);//bells
sparki.beep(400, 250);
delay(330);//jin
sparki.beep(400, 250);
delay(330);//gle
sparki.beep(400, 450);
delay(530);//bells
sparki.beep(400, 250);
delay(330);//jin
sparki.beep(600, 250);
delay(330);//gle
sparki.beep(300, 450);
delay(530);//all
sparki.beep(400, 150);
delay(230);//the
sparki.beep(400, 700);
delay(1020);//way
//second line
sparki.beep(500, 250);
delay(330);//oh
sparki.beep(500, 250);
delay(330);//what
sparki.beep(500, 250);
delay(330);//fun
sparki.beep(500, 150);
delay(230);//it
sparki.beep(500, 150);
delay(230);//is
sparki.beep(400, 250);
delay(330);//to
sparki.beep(400, 250);
delay(430);//ride
sparki.beep(400, 150);
delay(230);//in
sparki.beep(400, 150);
delay(230);//a
sparki.beep(400, 250);
delay(330);//one
sparki.beep(300, 250);
delay(330);//horse
sparki.beep(300, 250);
delay(330);//ohhh
sparki.beep(400, 250);
delay(330);//pen
sparki.beep(300, 700);
delay(1020);//sleigh
sparki.beep(800, 700);
delay(1020);//hey
}
delay(100000);
}

And here is a link to the video!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s