Mario's Video Build Guide
CODE & MATERIALS
- Chomper Bot Kit
- Scissors
- Box Cutter
- Repositional Glue Stick (for the magic trick!)
- Scotch Tape
- Duck Tape
- Ruler or Measuring Tape
- Markers
- 9v battery
- USB A/B Cable
- Screwdriver (optional)
Now to download Arduino and upload your code!
You’ll find an Arduino Uno board in your kit. This will be the brains of our bot! In order for Chomper Bot to work, we’ll have to upload our code to that Arduino! Here’s how we do that.
You’ll need: a computer with internet connection and a USB A/B cable.
Go to https://www.arduino.cc/en/software
In Download Options, select your operating system, and follow instructions to install the software on your computer.
Once installed, plug the Arduino board into your computer using a USB A/B cable.
Open the Arduino software. A blue and white window will pop up with the following text inside:
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
You’ll need to highlight and delete all that text.
Replace it with the following code for our Chomper Bot:
// 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() {
// put your setup code here, to run once:
EyeBall.attach(7); // HERE WE TELL ARDUINO WHICH PIN # THE EyeBall IS ATTACHED TO
Teeth.attach(8); // HERE WE 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!!
}
Great! Now, on the top left corner of the window, you will see two circular buttons: a check mark and an arrow pointing right. Those are your compile (check mark) and upload (arrow pointing right) buttons…
Click the check mark. A “Save sketch folder as” window will pop up. In the “Save As” line, you can rename your sketch to something like CHOMPER BOT. Then, click save.
The code will now compile, and you’ll see a “Done compiling” note toward the bottom of the bottom. If you receive an error instead, check your code to make sure everything was copied and pasted correctly.
Now, in the Arduino menu at the top of your computer screen (not in the sketch window,) click Tools > Board and select Arduino UNO.
Now click Tools > Port and select the one at the bottom of the list. Most likely something like ‘COM3 (Arduino/Genuino Uno)
Now, back in the Arduino sketch window, click the upload button (the circular button with the arrow pointing right.) When finished, it will say Done uploading toward the bottom of the window. Once your code is uploaded, unplug the board, and it’s ready for your Chomper Bot!
If the code compiles fine but will not upload, be sure you selected the correct board and port, and try again.
Learn the Chomper Bot routine as is first. But then, I encourage you to take the time to play around with the code and make some edits!
Some tips: When you see the words that are light gray, they are invisible to the Arduino. By adding // you create that light grey text. We use that feature to write notes between our code. If you read through it all, you will see that it’s not as crazy and confusing as it seems! We declare where our servo motors are plugged in (under void setup() ). We can also change the positions of the servo motor position. From 0 -180 degrees. Every time you see Teeth.write(130) or EyeBall.write(150); you can change those number! 130 means 130 degrees. Change some of them to 10 degrees and 57, etc… watch how the the teeth and eye move in different positions. When you see “ delay(200);” that just means wait! We use delay() to wait before movements. Delay(1000); means wait 1 second. You can add or make the number smaller. Delay(200); just means wait 200th of a second before the next action.