/* Program combining test-to-speech capabilities * with Scribbler 2 motion and sound * * Part 1: robot moves forward and right three times * while playing an ascending musical chord * Part 2: robot moves forward and left three times * while playing a descending musical chord * Part 3: repeats Part 1 * * Author: Henry M. Walker * Date created: 12 May 2016 * */ #include "eSpeakPackage.h" #include "MyroC.h" #include #include "scale-notes.h" /* Procedure to move the robot forward and right three times while playing an ascending musical chord */ void forward_right () { eSpeakTalk ("move forward and turn right"); rForward (1.0, 1.0); rBeep (0.5, pitchC6); rTurnRight (0.7, 0.75); eSpeakTalk ("move forward and turn right again"); rForward (1.0, 1.0); rBeep (0.5, pitchE6); rTurnRight (0.7, 0.5); eSpeakTalk ("move and turn a third time"); rForward (1.0, 1.0); rBeep (0.5, pitchG6); rTurnRight (0.7, 0.25); rBeep (0.5, pitchC7); } /* Procedure to move the robot forward and left three times while playing an descending musical chord */ void forward_left () { eSpeakTalk ("move forward and turn left"); rForward (1.0, 1.0); rBeep (0.5, pitchC7); rTurnLeft (0.7, 0.25); eSpeakTalk ("move forward and turn left again"); rForward (1.0, 1.0); rBeep (0.5, pitchG6); rTurnLeft (0.7, 0.5); eSpeakTalk ("move and turn a third time"); rForward (1.0, 1.0); rBeep (0.5, pitchE6); rTurnLeft (0.7, 0.75); rBeep (0.5, pitchC6); } int main () { // connect for both MyroC and eSpeak rConnect ("/dev/rfcomm0"); eSpeakConnect (); /* Part 1: robot moves forward and right three times while playing an ascending musical chord */ printf ("starting Part 1\n"); forward_right (); /* Part 2: robot moves forward and left three times while playing a descending musical chord */ eSpeakSetGender ("female"); // specify voice characteristics printf ("starting Part 2\n"); forward_left (); /* Part 3: robot moves forward and right three times while playing an ascending musical chord */ eSpeakSetGender ("male"); // specify voice characteristics printf ("starting Part 3\n"); eSpeakTalk ("Part 3 repeats Part 1"); forward_right (); // finish with no errors eSpeakTalk ("Enough of this; I am going to stop now"); rDisconnect (); eSpeakDisconnect (); return 0; }