// BusyHelloWorld.pde - a modified version of HelloWorld.pde // a demo showing example usage of SpeakJet Busy line monitoring // written by Galen Raben / www.droidbuilder.com 4-29-2010 // set up a new software serial port //rxPin: the pin on which to receive serial data //txPin: the pin on which to transmit serial data //busyPin: the pin used to monitor SpeakJet Busy line #include #define txPin 2 #define rxPin 3 #define busyPin 4 // set up the SoftwareSerial port to connect to the SpeakJet SoftwareSerial speakJet = SoftwareSerial(rxPin, txPin); /* HELLO WORLD SpeakJet MSA phonemes (see page 16 of SpeakJet User Manual) 20, 96, 21, 114, 22, 88, 23, 5, 183, 7, 159, 146, 164, 147, 151, 145, 176 v s p b H f E L O W A L E o p i e E a H O W W X E D l e t n s L W R e c d t L W R d h */ // char array holding string we want to speak byte sayThis[] = {20, 96, 21, 114, 22, 88, 23, 5, 183, 7, 159, 146, 164, 147, 151, 145, 176}; //say "hello world" void setup() { // define pin modes for tx, rx pins: //pinMode(rxPin, INPUT); //not needed for this demo pinMode(txPin, OUTPUT); speakJet.begin(9600); delay(1000); // wait a second for the Arduino resets to complete } void SJBusy(){ delay(20); // wait 12ms minimum before checking SpeakJet busy pin while(digitalRead(busyPin)){ delay(250); // wait here while SpeakJet is busy (pin 4 is true) } delay(250); // a bit more delay is needed for some reason } void loop() { // send it to the SpeakJet for (int i=0; i