Happy Valentines Day from Sparki

Sparki shows off his very own heart beat when you hold your hand (or any other object) in front of his eyes (the ultrasonic range finder). Robots like company after all 🙂 ❤

Here is the code:

 

#include // include the sparki library
void setup() {
}
void heart() {
sparki.clearLCD();
sparki.drawLine(64, 64, 27, 30);
sparki.drawLine(64, 64, 28, 30);
sparki.drawLine(64, 64, 29, 30);
sparki.drawLine(64, 64, 41, 30);
sparki.drawLine(64, 64, 42, 30);
sparki.drawLine(64, 64, 43, 30);
sparki.drawLine(64, 64, 44, 30);
sparki.drawLine(64, 64, 31, 30);
sparki.drawLine(64, 64, 32, 30);
sparki.drawLine(64, 64, 33, 30);
sparki.drawLine(64, 64, 34, 30);
sparki.drawLine(64, 64, 35, 30);
sparki.drawLine(64, 64, 36, 30);
sparki.drawLine(64, 64, 37, 30);
sparki.drawLine(64, 64, 38, 30);
sparki.drawLine(64, 64, 39, 30);
sparki.drawLine(64, 64, 30, 30);
sparki.drawLine(64, 64, 45, 30);
sparki.drawLine(64, 64, 46, 30);
sparki.drawLine(64, 64, 47, 30);
sparki.drawLine(64, 64, 48, 30);
sparki.drawLine(64, 64, 49, 30);
sparki.drawLine(64, 64, 50, 30);
sparki.drawLine(64, 64, 51, 30);
sparki.drawLine(64, 64, 52, 30);
sparki.drawLine(64, 64, 53, 30);
sparki.drawLine(64, 64, 54, 30);
sparki.drawLine(64, 64, 55, 30);
sparki.drawLine(64, 64, 56, 30);
sparki.drawLine(64, 64, 57, 30);
sparki.drawLine(64, 64, 58, 30);
sparki.drawLine(64, 64, 59, 30);
sparki.drawLine(64, 64, 60, 30);
sparki.drawLine(64, 64, 61, 30);
sparki.drawLine(64, 64, 63, 30);
sparki.drawLine(64, 64, 64, 30);
sparki.drawLine(64, 64, 62, 30);
sparki.drawLine(64, 64, 65, 30);
sparki.drawLine(64, 64, 66, 30);
sparki.drawLine(64, 64, 67, 30);
sparki.drawLine(64, 64, 68, 30);
sparki.drawLine(64, 64, 69, 30);
sparki.drawLine(64, 64, 70, 30);
sparki.drawLine(64, 64, 71, 30);
sparki.drawLine(64, 64, 71, 30);
sparki.drawLine(64, 64, 73, 30);
sparki.drawLine(64, 64, 74, 30);
sparki.drawLine(64, 64, 75, 30);
sparki.drawLine(64, 64, 76, 30);
sparki.drawLine(64, 64, 77, 30);
sparki.drawLine(64, 64, 78, 30);
sparki.drawLine(64, 64, 79, 30);
sparki.drawLine(64, 64, 80, 30);
sparki.drawLine(64, 64, 81, 30);
sparki.drawLine(64, 64, 82, 30);
sparki.drawLine(64, 64, 83, 30);
sparki.drawLine(64, 64, 84, 30);
sparki.drawLine(64, 64, 85, 30);
sparki.drawLine(64, 64, 86, 31);
sparki.drawLine(64, 64, 87, 31);
sparki.drawLine(64, 64, 88, 31);
sparki.drawLine(64, 64, 89, 32);
sparki.drawLine(64, 64, 90, 32);
sparki.drawLine(64, 64, 91, 32);
sparki.drawLine(64, 64, 92, 32);
sparki.drawLine(64, 64, 93, 32);
sparki.drawLine(64, 64, 94, 32);
sparki.drawLine(64, 64, 95, 32);
sparki.drawLine(64, 64, 96, 32);
sparki.drawLine(64, 64, 97, 32);
sparki.drawLine(64, 64, 98, 32);
sparki.drawLine(64, 64, 99, 32);
sparki.drawLine(64, 64, 100, 32);
sparki.drawCircleFilled(45, 20, 20);
sparki.drawCircleFilled(85, 20, 20);
sparki.drawCircleFilled(64, 35, 20);
sparki.updateLCD();
}
void littleHeart() {
sparki.clearLCD();
sparki.drawLine(64, 54, 36, 20);
sparki.drawLine(64, 54, 37, 20);
sparki.drawLine(64, 54, 38, 20);
sparki.drawLine(64, 54, 39, 20);
sparki.drawLine(64, 54, 41, 20);
sparki.drawLine(64, 54, 42, 20);
sparki.drawLine(64, 54, 43, 20);
sparki.drawLine(64, 54, 44, 20);
sparki.drawLine(64, 54, 45, 20);
sparki.drawLine(64, 54, 46, 20);
sparki.drawLine(64, 54, 47, 20);
sparki.drawLine(64, 54, 48, 20);
sparki.drawLine(64, 54, 49, 20);
sparki.drawLine(64, 54, 50, 20);
sparki.drawLine(64, 54, 51, 20);
sparki.drawLine(64, 54, 52, 20);
sparki.drawLine(64, 54, 53, 20);
sparki.drawLine(64, 54, 54, 20);
sparki.drawLine(64, 54, 55, 20);
sparki.drawLine(64, 54, 56, 20);
sparki.drawLine(64, 54, 57, 20);
sparki.drawLine(64, 54, 58, 20);
sparki.drawLine(64, 54, 59, 20);
sparki.drawLine(64, 54, 60, 20);
sparki.drawLine(64, 54, 61, 20);
sparki.drawLine(64, 54, 62, 20);
sparki.drawLine(64, 54, 63, 20);
sparki.drawLine(64, 54, 64, 20);
sparki.drawLine(64, 54, 65, 20);
sparki.drawLine(64, 54, 66, 20);
sparki.drawLine(64, 54, 67, 20);
sparki.drawLine(64, 54, 68, 20);
sparki.drawLine(64, 54, 69, 20);
sparki.drawLine(64, 54, 70, 20);
sparki.drawLine(64, 54, 71, 20);
sparki.drawLine(64, 54, 71, 20);
sparki.drawLine(64, 54, 73, 20);
sparki.drawLine(64, 54, 74, 20);
sparki.drawLine(64, 54, 75, 20);
sparki.drawLine(64, 54, 76, 20);
sparki.drawLine(64, 54, 77, 20);
sparki.drawLine(64, 54, 78, 20);
sparki.drawLine(64, 54, 79, 20);
sparki.drawLine(64, 54, 80, 20);
sparki.drawLine(64, 54, 81, 20);
sparki.drawLine(64, 54, 82, 20);
sparki.drawLine(64, 54, 83, 20);
sparki.drawLine(64, 54, 84, 20);
sparki.drawLine(64, 54, 85, 20);
sparki.drawLine(64, 54, 86, 21);
sparki.drawLine(64, 54, 87, 21);
sparki.drawLine(64, 54, 88, 21);
sparki.drawCircleFilled(50, 20, 13);
sparki.drawCircleFilled(75, 20, 13);
sparki.drawCircleFilled(64, 30, 6);
sparki.updateLCD();
}
void loop() {
while (sparki.ping() > 10)
{
sparki.RGB(RGB_RED);
delay(500);
sparki.RGB(RGB_ORANGE);
delay(500);
sparki.RGB(RGB_YELLOW);
delay(500);
sparki.RGB(RGB_GREEN);
delay(500);
sparki.RGB(RGB_BLUE);
delay(500);
sparki.RGB(RGB_INDIGO);
delay(500);
sparki.RGB(RGB_VIOLET);
delay(500);
sparki.RGB(RGB_WHITE);
delay(500);
}
littleHeart();
delay(1000);
heart();
delay(1000);
}

 

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