Sparki tells jokes

Sparki tells jokes! I plan to expand this program to add as many jokes as possible. I’d like to get 100 robot jokes collated. I’d also like to integrate this with my free roam code, so that when Sparki is hanging around, you can also read jokes too.

Here is the code:

#include // include the sparki library
void setup() {
sparki.servo(30);
}
void jokechoice(){
randomSeed(analogRead(1));
int joke = random(1, 3);
if (joke == 1){
sparki.clearLCD();
sparki.drawString(10, 3, "Who do bad robots ");
sparki.drawString(10, 5, "run away from?");
sparki.updateLCD();
delay(3000);
sparki.RGB(RGB_BLUE);
sparki.RGB(RGB_GREEN);
sparki.RGB(RGB_RED);
sparki.clearLCD();
sparki.drawString(10, 3, "Robo cop! ");
sparki.updateLCD();
delay(3000);
}
if (joke==2){
sparki.clearLCD();
sparki.drawString(10, 3, "What do you call a ");
sparki.drawString(10, 5, "robot in Antartica?");
sparki.updateLCD();
delay(3000);
sparki.RGB(RGB_BLUE);
sparki.RGB(RGB_GREEN);
sparki.RGB(RGB_RED);
sparki.clearLCD();
sparki.drawString(10, 3, "Cold ");
sparki.updateLCD();
delay(3000);
}
if (joke==3){
sparki.clearLCD();
sparki.drawString(10, 3, "What is a robots ");
sparki.drawString(10, 5, "favourite snack");
sparki.updateLCD();
delay(3000);
sparki.RGB(RGB_BLUE);
sparki.RGB(RGB_GREEN);
sparki.RGB(RGB_RED);
sparki.clearLCD();
sparki.drawString(10, 3, "Micro chips!");
sparki.updateLCD();
delay(3000);
}
}
void loop(){
while(sparki.ping()>10)
{
sparki.RGB(RGB_RED);
sparki.clearLCD();
sparki.drawString(10, 3, "Want a joke? ");
sparki.updateLCD();
delay(3000);
}
jokechoice();
}

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