Recent Changes - Search:

TEAMS Academy Wiki

THS

Explore TEAMS!
for visiting sophomores & juniors


Robotics


EnvBioTech

Bat Design

Assistive Tech

Students

Instructors

TEAMS Forum

TEAMS Calendar

TEAMS Web Site

Wiki Info

edit Robots.SideBar

Find a Ball

Goal

  • To Show our opponents that not only can we whoop them in the egg hunt, but we can do it while playing a catchy tune.

Notes

  • Manan: How much time will this waste? We don't want a robot that can play music but is inefficient at the task it is meant to do. This should really only be an added feature that we can add once we finish getting the egg hunt portion to work, and only if this doesn't significantly slow down the robot.

Code

  • Enter actual function code here, once completed
  • Function Declaration:
     PlayMusic()
       /*Pre: What note it is currently on
        *Post: Plays Note*/
       {
        //code here
       }

Quote from CreateBase:

How to play music in WinWVR (one method):
 
void updateMusic(void);

int song_time = 0, song = 0;
int playlist[] = { 4, 5, 4, 5, 0, 1, 2, 3 };
int playtime[] = {6000, 1750, 6000, 1750, 6000, 6000, 6000, 6000 };
//stores all the music:
  int sing[] = { 140, 0, 13, 64, 32, 65, 16, 67, 16, 72, 64, //start Indy
		30, 16, 62, 32, 64, 16, 65, 64, 30, 16, 67,
		32, 69, 16, 71, 16, 77, 48,
	  140, 1, 14, 69, 32, 71, 16, 72, 32, 74, 32,
		76, 32, 30, 16, 64, 32, 65, 16, 67, 16, 72, 
		64, 30, 16, 74, 32, 76, 16, 77, 32,
	  140, 2, 12, 67, 32, 67, 16, 76, 48, 74, 16,
		67, 16, 76, 48, 74, 16, 67, 16, 77, 48,
		76, 32, 74, 16, 72, 64,
	  140, 3, 6, 30, 64, 30, 64, 30, 64, 30, 64,
		30, 64, 30, 64,				//end Indy
	  140, 4, 15, 65, 16, 65, 16, 65, 16, 70, 48,   //start SW
		77, 48, 75, 16, 74, 16, 72, 16, 82, 48, 77, 32,
		75, 16, 74, 16, 72, 16, 82, 48, 77, 32,
	  140, 5, 4, 75, 16, 74, 16, 75, 16, 72, 64,
	  140, 15, 4, 65, 16, 65, 16, 69, 16, 65, 32};

  //executes the commands from sing[]
  for(int i=0; i < 157; i++)
  {
    cr8_byte_tx( sing[i] ); //sends a byte to the create
  } 
// updateMusic() checks to see if a song is done and
// plays the next one if it is.  Returns nothing.
void updateMusic(void){
	if(song_time > playtime[song % 8]){// 6000){
		cr8_byte_tx(141);
		cr8_byte_tx(playlist[song % 8]);
		song_time = 0;
		song++;
	}
	return;
}  //end updateMusic

Back

Edit - History - Print - Recent Changes - Search
Page last modified on December 30, 2007, at 09:46 PM