/************************************************************************* Mazebot Starter File **************************************************************************/ // Global Sensor Threshold Constants - based on experimentation with our // light sensors #define LINE_THRESH 48 // sensor reading below this is a line #define NODE_THRESH 38 // below this is a node // Global Motor constants #define DRIVE_PWR 2 // power level when driving forward #define TURN_PWR 1 // power level when turning in place #define SRCH_TIME 3 // smallest amount of search time; 100 = 1 sec // Define NQC Sensors to detect line, light source #define LINE SENSOR_2 // Define NQC Motors for left and right side of robot #define LEFT OUT_A #define RIGHT OUT_C // Direction of current turn #define TURNING_LEFT 0 #define TURNING_RIGHT 1 //========================================================================== // PlaySong() // // Written by: DLM // // Description: Helper function for playing the Star Wars song. void PlaySong(const int tone, const int duration) { PlayTone(tone,duration); Wait(duration); } //========================================================================== // StarWars() // // Written by: DLM // // Description: Plays the Star Wars theme song. void StarWars() { PlayTone(523,100); PlayTone(784,100); PlayTone(698,13); PlayTone(659,13); PlaySong(587,13); PlaySong(1046,100); PlaySong(784,100); PlaySong(698,13); PlaySong(659,13); PlaySong(587,13); PlaySong(1046,100); PlaySong(784,100); PlaySong(698,13); PlaySong(659,13); PlaySong(698,13); PlaySong(587,100); PlaySong(392,13); PlaySong(392,13); PlaySong(392,13); PlaySong(523,100); PlaySong(784,100); PlaySong(698,13); PlaySong(659,13); PlaySong(587,13); PlaySong(1046,100); PlaySong(784,100); PlaySong(698,13); PlaySong(659,13); PlaySong(587,13); PlaySong(1046,100); PlaySong(784,100); PlaySong(932,13); PlaySong(880,13); PlaySong(932,13); PlaySong(784,100); } //========================================================================== // m a i n ( ) //========================================================================== task main() { // configure sensors SetSensor(LINE, SENSOR_LIGHT); // follow the line until the end findline(); followline(); // celebrate! StarWars(); } // end main