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 🙂
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();
}
Very cool. Is that one of those Arduino clones? The code looks like Arduino code, based on my minimal experience with Arduino programming.
LikeLike
Hey sorry for the delayed reply. It is, its called sparkiduino 😊
LikeLike