Emic 2 + Arduino Mega 2560: Problems Getting Started No Sound
insultcomicdog
Posts: 3
I just picked up the Emic 2 Text-to-Speech Module, and I've run into issues running the example Arduino sketch:
http://www.parallax.com/Portals/0/Downloads/docs/prod/sens/30016-Emic2-Arduino.zip
Here are some pics of my setup:
I stripped down my Mega so it's down to it's bare bones, and I'm not getting any audio output from the module. I put some traces in and the sketch dies after sending a carriage return to the module. The loop function doesn't get called at all. Is there something simple I'm missing or is there something up with my module?
Here's my code:
http://www.parallax.com/Portals/0/Downloads/docs/prod/sens/30016-Emic2-Arduino.zip
Here are some pics of my setup:
I stripped down my Mega so it's down to it's bare bones, and I'm not getting any audio output from the module. I put some traces in and the sketch dies after sending a carriage return to the module. The loop function doesn't get called at all. Is there something simple I'm missing or is there something up with my module?
Here's my code:
/* Emic 2 Text-to-Speech Module: Basic Demonstration Author: Joe Grand [www.grandideastudio.com] Contact: support@parallax.com Program Description: This program provides a simple demonstration of the Emic 2 Text-to-Speech Module. Please refer to the product manual for full details of system functionality and capabilities. Revisions: 1.0 (February 13, 2012): Initial release */ // include the SoftwareSerial library so we can use it to talk to the Emic 2 module #include <SoftwareSerial.h> #define rxPin 2 // Serial input (connects to Emic 2 SOUT) #define txPin 3 // Serial output (connects to Emic 2 SIN) #define ledPin 13 // Most Arduino boards have an on-board LED on this pin // set up a new serial port SoftwareSerial emicSerial = SoftwareSerial(rxPin, txPin); void setup() // Set up code called once on start-up { Serial.begin(9600); // start serial for output Serial.println("setting up pins"); // define pin modes pinMode(ledPin, OUTPUT); pinMode(rxPin, INPUT); pinMode(txPin, OUTPUT); // set the data rate for the SoftwareSerial port emicSerial.begin(9600); digitalWrite(ledPin, LOW); // turn LED off /* When the Emic 2 powers on, it takes about 3 seconds for it to successfully intialize. It then sends a ":" character to indicate it's ready to accept commands. If the Emic 2 is already initialized, a CR will also cause it to send a ":" */ Serial.println("sending CR"); emicSerial.print('\n'); // Send a CR in case the system is already up while (emicSerial.read() != ':'); // When the Emic 2 has initialized and is ready, it will send a single ':' character, so wait here until we receive it Serial.println("waiting for :"); delay(10); // Short delay emicSerial.flush(); // Flush the receive buffer } void loop() // Main code, to run repeatedly { // Speak some text Serial.println("loop"); emicSerial.print('S'); emicSerial.print("Hello. My name is the Emic 2 Text-to-Speech module. I would like to sing you a song."); // Send the desired string to convert to speech emicSerial.print('\n'); digitalWrite(ledPin, HIGH); // Turn on LED while Emic is outputting audio while (emicSerial.read() != ':'); // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command digitalWrite(ledPin, LOW); delay(500); // 1/2 second delay // Sing a song emicSerial.print("D1\n"); digitalWrite(ledPin, HIGH); // Turn on LED while Emic is outputting audio while (emicSerial.read() != ':'); // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command digitalWrite(ledPin, LOW); while(1) // Demonstration complete! { Serial.println("demo complete"); delay(500); digitalWrite(ledPin, HIGH); delay(500); digitalWrite(ledPin, LOW); } }
Comments
I've tested the following RX/TX pins..
Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and 16 (TX); Serial 3: 15 (RX) and 14 (TX).
I was actually able to get audio through pins 0, 1 but NOT through any of the other Serial pins pairs.
I have this in my setup function :
Serial.begin(9600);
Serial1.begin(9600);
Serial2.begin(9600);
Serial3.begin(9600);
I'm would like to use to use Serial3 b/c I'm already using Serial2 for another device. Any ideas why the other serial pins wouldn't work?
By "by passing the SoftwareSerial library", what does that mean? What do I have to do to bypass it?