The Story Behind Otto's Dance Party
It all started on a rainy afternoon when boredom hit hard. The usual coding projects just weren't cutting it, and the thought of another plain old blinking LED felt like a snooze fest. That's when the idea struck: why not create a robot with some serious dance moves?
Meet Otto, the robot with rhythm! But Otto wasn’t always the life of the party. In fact, he started off as a shy little bot, barely moving an inch. With some creative engineering, a few servos, and a touch sensor, Otto was transformed into the ultimate dance machine.
The Transformation
At first, Otto could only manage a simple forward and backward shuffle—barely enough to keep up with the beat. But soon, Otto learned to walk with swagger, turn on a dime, and even bust out a moonwalk that would make MJ proud! With a little more tinkering, Otto mastered the art of bending, shaking his leg like he was born to groove, and flapping his limbs like there’s no tomorrow.
But Otto wasn’t just about moving; he was about moving with style. That's where the touch sensor came in. One tap, and Otto would switch up his dance routine like a pro DJ, complete with his own theme music to keep the vibe going.
Otto’s Big Debut
After weeks of practice, Otto was ready for the big stage. His first dance party was a hit—he danced, turned, and moonwalked his way into everyone’s hearts. And just when you thought you’d seen all his moves, he surprised the crowd with a custom dance routine that left everyone cheering for an encore.
The Future of Otto
What’s next for Otto? Who knows—maybe he’ll start a dance-off challenge, or even take his moves to the big screen. For now, Otto’s just happy being the coolest bot on the block, ready to bust a move at a moment’s notice.
Funny video: https://www.instagram.com/reel/C_NudNEyAa3/?igsh=d2k3OXpteGU4d2s=
Working Explanation:
Setup Phase:
Pin Definitions: The robot’s legs and feet are controlled by servos connected to specific pins on the Arduino Nano. These pins are defined at the beginning of the code (LeftLeg, RightLeg, LeftFoot, RightFoot).
Initialization: The setup() function initializes the Otto robot by specifying which pins control the servos and the buzzer. The touch sensor is also set up as an input.
Startup Sound: When the robot is powered on, it plays a sound using the buzzer to indicate it is ready.
Main Loop:
Touch Detection: The robot continuously checks the touch sensor in the loop() function. If the sensor detects a touch, it triggers the changeMode() function to switch to the next movement mode.
Mode Execution: The robot performs different actions based on the current mode, which are predefined in the performMove() function. For example, it can walk, turn, bend, shake its leg, or perform specific dance moves.
Sound Feedback: Each time the mode changes, the robot plays a unique sound, providing feedback that the mode has switched.
Movement Modes:
The robot has a total of 14 modes (totalModes = 14), each associated with a different action:
Here's a description you can use for your GitHub repository:
Walking:The robot can walk both forward and backward.
Turning: It can turn left and right.
Bending: The robot can bend forward and backward.
Shaking Leg: A fun leg-shaking motion.
Moonwalking: Performs the iconic moonwalk, both left and right.
Crusaito: A side-to-side motion similar to dancing.
Flapping: Mimics flapping its arms (or legs in this case).
Jumping: The robot can jump in place.
Custom Dance Moves: Unique dance sequences combining different moves.
How It Works
The robot's modes are changed using a touch sensor. Each mode triggers a different movement or dance sequence, making the robot dynamic and entertaining. The robot also plays unique sounds with each mode change, enhancing the interactive experience.
Mode Control:
Each time the touch sensor is activated, the robot switches to the next mode in the sequence. When it reaches the last mode, it loops back to the first mode.
The movements in each mode are defined in the performMove() function. If a movement is triggered, it is performed, and the robot then waits for the next touch input to switch modes.
How to Use:
Assembling the Robot:
Attach the four servos to the Otto robot’s legs and feet.
Connect the servos to the Arduino Nano using the pins defined in the code.
Attach the touch sensor to a suitable part of the robot where it can be easily touched.
Connect the buzzer to the Arduino for sound feedback.
Powering On:
When you power on the robot, it will play a startup sound to indicate it is ready.
Changing Modes:
Touch the sensor to change the robot’s mode. The robot will perform the corresponding action and play a sound to indicate the change.
You can continue touching the sensor to cycle through all the available modes.
Resetting:
The robot automatically resets to the home position when it completes a mode cycle, or if it’s in a mode with no specific action, ensuring it's ready for the next command.Code
#include <Otto.h>
Otto Otto;
// Pin Definitions
#define LeftLeg 2
#define RightLeg 3
#define LeftFoot 4
#define RightFoot 5
#define Buzzer 13
#define TouchSensor 7
int currentMode = 0; // Variable to store the current mode
int totalModes = 14; // Total number of modes available
void setup() {
Otto.init(LeftLeg, RightLeg, LeftFoot, RightFoot, true, Buzzer); // Set the servo pins and Buzzer pin
pinMode(TouchSensor, INPUT);
Otto.sing(S_connection); // Otto wake up!
Otto.home();
}
void loop() {
if (digitalRead(TouchSensor) == HIGH) {
changeMode();
Otto.sing(S_surprise); // Play a unique sound each time the mode changes
delay(1000); // Debounce delay
}
performMove();
}
void performMove() {
switch (currentMode) {
case 0:
Otto.walk(4, 1000, 1); // Walking Forward
delay(500); // Short delay between moves
break;
case 1:
Otto.walk(4, 1000, -1); // Walking Backward
delay(500);
break;
case 2:
Otto.turn(4, 1000, 1); // Turning Left
delay(500);
break;
case 3:
Otto.turn(4, 1000, -1); // Turning Right
delay(500);
break;
case 4:
Otto.bend(1, 1000, 1); // Bending Forward
delay(500);
break;
case 5:
Otto.bend(1, 1000, -1); // Bending Backward
delay(500);
break;
case 6:
Otto.shakeLeg(2, 1500, 1); // Shaking Leg
delay(500);
break;
case 7:
Otto.moonwalker(4, 1000, 25, 1); // Moonwalker Left
delay(500);
break;
case 8:
Otto.moonwalker(4, 1000, 25, -1); // Moonwalker Right
delay(500);
break;
case 9:
Otto.crusaito(2, 1000, 25, 1); // Crusaito Left
delay(500);
break;
case 10:
Otto.crusaito(2, 1000, 25, -1); // Crusaito Right
delay(500);
break;
case 11:
Otto.flapping(2, 1000, 25, 1); // Flapping
delay(500);
break;
case 12:
Otto.jump(1, 1000); // Jump
delay(500);
break;
case 13:
danceMove1(); // Dance Move 1
break;
case 14:
danceMove2(); // Dance Move 2
break;
default:
Otto.home(); // Return to home position
delay(500);
break;
}
}
void changeMode() {
currentMode++;
if (currentMode > totalModes) {
currentMode = 0;
}
}
void danceMove1() {
Otto.moonwalker(2, 1000, 20, 1); // Moonwalker Left
delay(500);
Otto.moonwalker(2, 1000, 20, -1); // Moonwalker Right
delay(500);
Otto.shakeLeg(2, 1500, 1); // Shake Leg
delay(500);
}
void danceMove2() {
Otto.crusaito(2, 1000, 20, 1); // Crusaito Left
delay(500);
Otto.crusaito(2, 1000, 20, -1); // Crusaito Right
delay(500);
Otto.flapping(2, 1000, 20, 1); // Flapping Forward
delay(500);
}
Comments
Please log in or sign up to comment.