top of page

ROBOT MAGIC

CHAPTER Eight: Clown Nose Emoji Bot

Make_RobotMagic_Cover_01jb.jpg

A variation of the routine:

Copy + Paste this code to your Arduino Sketch:

Watercolor Stain

#include <Servo.h>

 

Servo OnTop; //let’s call the servo on top "OnTop"


 

Servo OnNose; //let’s call the nose making servo "OnNose"


 

void setup() {

 

   OnTop.attach(8);

 

   OnNose.attach(9);  

 

   OnNose.write(160); // OnNose IN HIDDEN POSITION

 

   OnTop.write(160); // OnTop In HIDDEN POSITION

 

}

   

void loop() {

 

/* This delay is to give us 10 seconds to put the nose on

   the robot and react as it keeps falling off!*/

    

   delay(10000);

 

// Nose appears on TOP!!

 

   OnTop.write(40); // OnTop APPEARS for the FIRST TIME!

 

   delay(3000);

 

   OnTop.write(160); // OnTop In HIDDEN POSITION

 

/* This delay gives us 3 seconds to pretend to take the

   nose from behind the robot's head and put it in our

   pocket */

 

   delay(3000);

 

// Nose appears on TOP AGAIN!!

 

   OnTop.write(40); // NOSE APPEARS for a SECOND TIME!

 

   delay(500);

 

// Nose WIGGLES on top

    

   OnTop.write(60);

   delay(250);

   OnTop.write(40);

   delay(500);

   OnTop.write(60);

   delay(250);

   OnTop.write(40);

   delay(500);

   OnTop.write(60);

   delay(250);

   OnTop.write(40);

// Nose stops wiggling.

    

   delay(1000);

 

   OnTop.write(160); // OnTop In HIDDEN POSITION

 

/* Here is a 3 second pause to allow us time to take the

   nose from behind AGAIN and put it in our pocket */

 

   delay(3000);

 

// Nose appears on TOP AGAIN!!

 

   OnTop.write(40); // NOSE APPEARS for a THIRD TIME!

 

   delay(500);

 

// Nose WIGGLES on top

 

   OnTop.write(60);

   delay(250);

   OnTop.write(40);

   delay(500);

   OnTop.write(60);

   delay(250);

   OnTop.write(40);

   delay(500);

   OnTop.write(60);

   delay(250);

   OnTop.write(40);

// Nose stops wiggling on top

 

   delay(1000);

 

   OnTop.write(160); // OnTop In HIDDEN POSITION

 

// Here we take the nose from behind AGAIN and pocket it.

 

   delay(3000);

 

   OnTop.write(40); // NOSE APPEARS for a FOURTH TIME!

 

   delay(500);

 

// Nose WIGGLES on top

   OnTop.write(60);

   delay(150);

   OnTop.write(40);

   delay(400);

   OnTop.write(60);

   delay(150);

   OnTop.write(40);

   delay(400);

   OnTop.write(60);

   delay(150);

   OnTop.write(40);

// Nose stops wiggling.

 

   delay(2000);

 

   OnTop.write(160); // OnTop In HIDDEN POSITION

 

/* Here is a two and a half-second delay to give us time

   to take the CONFETTI from behind and stand IN FRONT

   of the ROBOT */

 

 delay(2500);

 

/* WE LOAD THE CONFETTI INTO OUR RIGHT HAND AND BLOW THE

   CONFETTI OUT! */

 

 OnNose.write(10); //NOSE APPEARS ON ROBOT!

 

 delay(1500);

 

 OnNose.write(160); // OnNose IN HIDDEN POSITION

 

 // NOSE IS BOTH ON THE ROBOT AND YOU!

 

 delay(50000); // we wait 50 seconds to end the routine

 

}

Watercolor Stain

Show us your finished projects! Use #robotmagic in your social media posts and tag Mario!

  • Facebook
  • Instagram
  • Twitter
  • YouTube
  • TikTok
bottom of page