Sparki, Sphero BOLT and Vector deliver a Christmas message

3 robots. 3 different programs. 3 different programming languages:

In this video, the three different robots work together to deliver a festive greeting.

I attached the sound sensor to Sparki through the expansion port. And then programmed Sparki to be activated by sound, to play “Jingle bells” using the buzzer, and show a Christmas themed animation.

Sphero can be programmed to “speak” through the connected mobile device. So to trigger Sparki, Sphero gives a Christmas greeting. And then displays a snowy animation.

Finally, Vector was programmed using the SDK to deliver a Christmas message along with an appropriate character animation.

Here is the arduino code for Sparki:


#include // include the sparki library
void setup() {
// put your setup code here, to run once:
sparki.servo(30);
}
void fulltree() {
sparki.clearLCD();
sparki.drawLine(30, 25, 40, 25); //join in triangles
sparki.drawLine(85, 25, 75, 25); //join in triangles
sparki.drawLine(30, 25, 57, 5);
sparki.drawLine(85, 25, 57, 5);
sparki.drawLine(15, 50, 100, 50); //bottom of triangle
sparki.drawLine(15, 50, 40, 25);
sparki.drawLine(100, 50, 75, 25);
sparki.drawLine(52, 50, 52, 60);
sparki.drawLine(62, 50, 62, 60);
sparki.drawLine(52, 60, 62, 60);
sparki.drawCircleFilled(40, 45, 2);
sparki.drawCircleFilled(57, 42, 2);
sparki.drawCircleFilled(74, 40, 2);
sparki.drawCircleFilled(48, 35, 2);
sparki.drawCircleFilled(65, 32, 2);
sparki.drawCircleFilled(43, 25, 2);
sparki.drawCircleFilled(55, 22, 2);
sparki.drawCircleFilled(67, 20, 2);
sparki.drawCircleFilled(85, 45, 2);
sparki.drawCircleFilled(30, 38, 2);
sparki.drawCircleFilled(50, 16, 2);
sparki.updateLCD();
}
void snow1() {
sparki.clearLCD();
fulltree();
sparki.drawCircleFilled(5, 6, 1);
sparki.drawCircleFilled(50, 6, 1);
sparki.drawCircleFilled(30, 16, 1);
sparki.drawCircleFilled(20, 20, 1);
sparki.drawCircleFilled(10, 36, 1);
sparki.drawCircleFilled(70, 6, 1);
sparki.drawCircleFilled(90, 26, 1);
sparki.drawCircleFilled(110, 20, 1);
sparki.drawCircleFilled(120, 30, 1);
sparki.drawCircleFilled(97, 40, 1);
sparki.drawCircleFilled(115, 35, 1);
sparki.drawCircleFilled(120, 16, 1);
sparki.updateLCD();
}
void snow2() {
sparki.clearLCD();
fulltree();
sparki.drawCircleFilled(15, 6, 1);
sparki.drawCircleFilled(40, 6, 1);
sparki.drawCircleFilled(50, 16, 1);
sparki.drawCircleFilled(30, 20, 1);
sparki.drawCircleFilled(20, 36, 1);
sparki.drawCircleFilled(65, 6, 1);
sparki.drawCircleFilled(85, 16, 1);
sparki.drawCircleFilled(100, 20, 1);
sparki.drawCircleFilled(110, 30, 1);
sparki.drawCircleFilled(115, 6, 1);
sparki.drawCircleFilled(120, 12, 1);
sparki.drawCircleFilled(90, 10, 1);
sparki.drawCircleFilled(110, 45, 1);
sparki.drawCircleFilled(100, 40, 1);
sparki.drawCircleFilled(5, 30, 1);
sparki.drawCircleFilled(20, 27, 1);
sparki.updateLCD();
}
void song(){
snow1();
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);
snow2();
delay(330);//jin
sparki.beep(400, 250);
delay(330);//gle
sparki.beep(400, 450);
delay(530);//bells
sparki.beep(400, 250);
snow1();
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
snow2();
//second line
sparki.beep(500, 250);
delay(330);//oh
sparki.beep(500, 250);
delay(330);//what
sparki.beep(500, 250);
delay(330);//fun
snow1();
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
snow2();
sparki.beep(400, 150);
delay(230);//in
sparki.beep(400, 150);
delay(230);//a
sparki.beep(400, 250);
delay(330);//one
snow1();
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
snow2();
delay(10000);
}
void loop(){
sparki.RGB(RGB_GREEN);
int soundA=analogRead(0);
delay(500);
sparki.clearLCD();
sparki.print(soundA);
sparki.updateLCD();
delay(3000);
if (soundA>=0.5)
{
song();
}
}

Here is the JavaScript code for Sphero BOLT:

async function startProgram() {
setStabilization(false);
playMatrixAnimation(0, true);
await delay(2.5);
await speak('Hi Sparki! happy Christmas ', true);
playMatrixAnimation(1, true);
}

registerMatrixAnimation({
frames: [[[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 1, 1, 0, 0, 0], [0, 11, 0, 1, 1, 0, 11, 0], [0, 0, 0, 1, 1, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]],
palette: [{ r: 255, g: 255, b: 255 }, { r: 0, g: 0, b: 0 }, { r: 255, g: 0, b: 0 }, { r: 255, g: 64, b: 0 }, { r: 255, g: 128, b: 0 }, { r: 255, g: 191, b: 0 }, { r: 255, g: 255, b: 0 }, { r: 185, g: 246, b: 30 }, { r: 0, g: 255, b: 0 }, { r: 185, g: 255, b: 255 }, { r: 0, g: 255, b: 255 }, { r: 0, g: 0, b: 255 }, { r: 145, g: 0, b: 211 }, { r: 157, g: 48, b: 118 }, { r: 255, g: 0, b: 255 }, { r: 204, g: 27, b: 126 }],
fps: 10,
transition: MatrixAnimationTransition.None
});
registerMatrixAnimation({
frames: [[[1, 1, 0, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 1, 1, 1], [1, 1, 0, 1, 1, 0, 1, 1], [1, 1, 1, 1, 0, 0, 0, 1], [1, 1, 1, 1, 1, 0, 1, 1], [1, 1, 0, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1, 1, 1]], [[1, 1, 1, 1, 1, 1, 1, 0], [1, 1,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 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 0, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 1, 1, 1]]],
palette: [{ r: 255, g: 255, b: 255 }, { r: 0, g: 0, b: 0 }, { r: 255, g: 0, b: 0 }, { r: 255, g: 64, b: 0 }, { r: 255, g: 128, b: 0 }, { r: 255, g: 191, b: 0 }, { r: 255, g: 255, b: 0 }, { r: 185, g: 246, b: 30 }, { r: 0, g: 255, b: 0 }, { r: 185, g: 255, b: 255 }, { r: 0, g: 255, b: 255 }, { r: 0, g: 0, b: 255 }, { r: 145, g: 0, b: 211 }, { r: 157, g: 48, b: 118 }, { r: 255, g: 0, b: 255 }, { r: 204, g: 27, b: 126 }],
fps: 2,
transition: MatrixAnimationTransition.None
});

Here is the python code for Vector:

Untitled

One comment

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