ROBOT MAGIC
CHAPTER Ten: Chomper Bot

Copy + Paste this code to your Arduino Sketch:

// CHOMPER BOT MAGIC
// BY: Mario Marchese (MARIO THE MAKER MAGICIAN)
// in collaboration with Make:
// Dec. 2020
#include <Servo.h>
Servo Teeth;
Servo EyeBall;
void setup() {
EyeBall.attach(7); // TELL ARDUINO WHICH PIN # THE EyeBall
// IS ATTACHED TO
Teeth.attach(8); // TELL ARDUINO WHICH PIN # THE teeth
// IS ATTACHED TO
// HERE WE PLACE A PLAY ONE TIME CODE
Teeth.write(130); // MOUTH in OPEN POSITION
delay(2000);
EyeBall.write(10);
delay(500);
EyeBall.write(150);
delay(500);
EyeBall.write(10);
delay(500);
EyeBall.write(150);
delay(500);
EyeBall.write(10);
delay(3000);
}
void loop() {
// put your main code here, to run repeatedly:
// MONSTER WILL CHOMP LIKE CRAZY!! HERE!
//// 1 CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(150);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
///////////////////////////////////////////////
//// 2nd CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(150);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
///////////////////////////////////////////////
//// 3rd CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(150);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
///////////////////////////////////////////////
//// 4th CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(150);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
///////////////////////////////////////////////
//// 5th CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(150);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
///////////////////////////////////////////////
//// 6th CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(150);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
///////////////////////////////////////////////
//// 7th CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(150);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
///////////////////////////////////////////////
//// 8th CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(150);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
///////////////////////////////////////////////
//// 9th CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(150);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
///////////////////////////////////////////////
//// 10th CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(150);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
///////////////////////////////////////////////
//// 11th CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(150);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
///////////////////////////////////////////////
//// 12th CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(150);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
///////////////////////////////////////////////
//// 13th CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(150);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
///////////////////////////////////////////////
//// 14th CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(150);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
///////////////////////////////////////////////
//// 15th CHOMP HERE!///////////////////////////
EyeBall.write(10);
Teeth.write(130); // MOUTH in OPEN POSITION
delay(200);
EyeBall.write(90);
Teeth.write(60); // MOUTH in CLOSED POSITION
delay(200);
Teeth.write(130); // MOUTH in OPEN POSITION
///////////////////////////////////////////////
delay(60000); // Wait 1 minute before it starts again!!
}
