Offline
Newbie
Karma: 0
Posts: 15
|
 |
« Reply #3 on: February 28, 2011, 09:35:26 am » |
Thanks all. I have an Arduino Uno and my SpeakJet is connected to it per the instructions in the SpeakJet documentation. Works great for speech strings that are sent from an arduino program. For example, the following works great:
#include <NewSoftSerial.h> // set up the SoftwareSerial port to connect to the SpeakJet int lightPin = 0; int done = 0; NewSoftSerial SpeakJetSerial = NewSoftSerial(2, 3);
char goodMorning[] = {20, 96, 21, 114, 22, 100, 23, 2, 8, 179, 138, 138, 177, 140, 7, 137, 7, 153, 22, 150, 141, 129, 143, 30, 10, 22, 100, 187, 191, 8, 131, 186, 132, 132, 141, 22, 120, 128, 22, 130, 128, 0}; void setup() { SpeakJetSerial.begin(9600); } void loop() { int val; int threshold = 625 ; val=analogRead(lightPin); // read the light level from the light pin. if (val <= threshold) // light level goes from 0 to 900. Higher number is darker. { if (done == 0) // if we haven't spoken yet... { SpeakJetSerial.print(goodMorning); // send string to the SpeakJet done = 1; // set done to 1 so it doesn't keep talking forever. } } else { done = 0; // set done back to 0 so the next time the light comes on // it will speak again. } delay (1000); } -------------------------------------------------------------------- With a different program, I was hoping to use the arduino as kind of a "passthrough" from my PC to the SpeakJet since the PC is already connected to the arduino via the USB software serial port, and the speakjet is connected to the arduino.
So I want to also be able to test out sounds and phrases using phraselator without having to disconnect the speakjet from the arduino.
To make arduino a "passthrough" to speakJet, I figured I would just read anything that comes across the serial port from the PC to the arduino and print it to the speakjet port.
Using the code below, I can send data from the Phraselator to the arduino (I can see the arduino Rx light flashing when I send the data). But it doesn't seem to send it to the SpeakJet to make the sounds.
#include <NewSoftSerial.h>
NewSoftSerial SpeakJetSerial = NewSoftSerial(2, 3);
void setup() { SpeakJetSerial.begin(9600); // serial port to SpeakJet. Serial.begin(9600); // serial port from PC to arduino. }
void loop() { if (Serial.available()) { SpeakJetSerial.print((char)Serial.read()); } }
|