Originally Posted by devinc
I tried your code out today. it worked perfectly. it was really weird hearing super mario and pac man coming out of my robot. I really hope that the speaker is not legal in competition because it got annoying just after a few seconds.
Glad it worked for you, I agree that it can be really annoying, it's not something I'm going to encourage on team
8888's robot but it may be fun for the demonstrations we do at elementary schools.
I'm posting another version with the code cleaned up a bit and some null pointer and invalid parameter checking. There is no change in functionality, I just wanted to clean it up a little (the old versions have been removed
). I will also email Intelitek and hopefully they can incorporate some official functions soon, when they do that this code should not be used as it will conflict with their code.
Functions available are as follows, see the source and demo code for explanations.
void PlayFrequency( int freq, int amplitude, int timems );
void PlayFrequencyWait( int freq, int amplitude, int timems );
void ClearSounds( void );
int InitChipToneSong( int len );
void DeinitChipToneSong( void );
void StartChipToneSong( int repeat );
void SetNextChipTone( int freq, int amplitude, int timems );
void DebugChipTone( void );
char *PlayRtttl( char *song , int amplitude, int repeat );