Sparki is ready for Spring

This is just a short piece of code that shows a flower on the screen, when an object is detected as less than 10 cm away. I used the Valentines day code and changed the design to that of a flower, because I didnt have as much time to program this month. Still, it was great to tinker around for half hour 🙂

arcbotics sparki

Here is the short piece of code:

#include <Sparki.h> // include the sparki library
void setup() {
}
void flower() {
sparki.clearLCD();
sparki.drawCircle(64,20,10);
sparki.drawCircle(64, 45,10);
sparki.drawCircle(47,32,10);
sparki.drawCircle(82,32,10);
sparki.drawCircleFilled(64,32,10);
sparki.updateLCD();
}

void loop() {
while (sparki.ping() > 10)
{
sparki.clearLCD();
sparki.updateLCD();
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);
}
flower();
}

 

2 comments

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