Hokey-Pokey Dance Code

/************************************************************************
********* Let’s Dance!!
********* This program will command the robot to dance the hokey-pokey
3/6/2013, this version works equally well with the Link or CBC controller
(msleep function used for delay)
***************************************************************************/
//It also shows the use of functions: “prototypes” are listed before the main
 void right_in ();
 void right_out();
 void left_in ();
 void left_out();
 void shake_it_all_about();
 void turn_yourself_around();
int main()
 {
 right_in();
 right_out();
 right_in();
 shake_it_all_about();
 turn_yourself_around();
msleep(250);
printf("That's what it's all about!\n");
 beep();
 beep();
msleep(750);
left_in();
 left_out();
 left_in();
 shake_it_all_about();
 turn_yourself_around();
printf("That's what it's all about!\n");
 beep();
 beep();
 printf("Hokey-Pokey!!");
 beep();
 beep();
 beep();
 }// end main
//the functions are defined below:
 void right_in()
 {
 motor(0,75);
 msleep(2000);
 ao();
 }
void right_out()
 {
 motor(0,-75);
 msleep(2000);
 ao();
 }
void left_in()
 {
 motor(2,75);
 msleep(2000);
 ao();
 }
void left_out()
 {
 motor(2,-75);
 msleep(2000);
 ao();
 }
void shake_it_all_about()
 {
 int i=0;
 while (i<5)
 {
 motor(0,100);
 motor(2,-100);
 msleep(100);
 motor(0,-100);
 motor(2,100);
 msleep(100);
 i=i+1;
 }
 ao();
 }
void turn_yourself_around ()
 {
 motor(0,100);
 motor(2,-100);
 msleep(3000);
 ao();
 }

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 )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s