// TTS_R2D2demo_2.pde // written by Galen Raben / www.droidbuilder.com // 5-15-2010 // Demonstrates a method of combining speech and sound effects // with the SpeakJet Shield TTS //set up a SoftwareSerial port for Speakjet Shield //rxPin: the pin on which to receive serial data from TTS256 //txPin: the pin on which to transmit serial data to the TTS256 #include #define txPin 2 #define rxPin 3 SoftwareSerial speakJet = SoftwareSerial(rxPin, txPin); void setup(){ // initialize the serial communications with the SpeakJet-TTS256 pinMode(rxPin, INPUT); pinMode(txPin, OUTPUT); speakJet.begin(9600); // set the data rate for the SoftwareSerial port delay(500); // wait a moment for the Arduino resets to finish // R2D2 beeps: 223, 4, 222, 5, 207, 4, 238 // hexidecimal: DF 04 DE 05 CF 04 EE speakJet.println("I can sound like R2D2 \xDF\x04\xDE\x05\xCF\x04\xEE"); // send speech & sounds } void loop() {}