I've been trying to use the emic text to speech module, (Emic 2 Text-to-Speech module : ID 924 : $59.95 : Adafruit Industries, Unique & fun DIY electronics and kits) in my code while using I2c communication with my Arduinos. I have tested the I2c with serial.print statments of the text when getting a 1 or 0 from the master arduino.But when I add the emic.speak command the whole program doesn't run at all, but it is still verified.When I run the module alone it's fine but when i put it in any other code it doesn't work. Any help would be greatly appreciated.
Slave-
#include <Wire.h>
#include <SoftwareSerial.h> // Needed by the EMIC2 library
#include <SD.h> // Needed by the EMIC2 library, though not utilized in this example
#include "EMIC2.h"
#define RX_PIN 0 // Connect SOUT pin of the Emic 2 module to the RX pin
#define TX_PIN 1 // Connect SIN pin of the Emic 2 module to the TX pin
EMIC2 emic;
void setup() {
Wire.begin(8); // join i2c bus with address #8
Wire.onReceive(receiveEvent); // register event
Serial.begin(9600);
emic.begin(RX_PIN, TX_PIN); //set' s up the emic pins
emic.setVoice(8);//
}
void loop() {
}
void receiveEvent(int howMany) {
while (Wire.available()) {
int x = Wire.read();
if (x == 1){
emic.speak("yes");//HERE is the one line that if I add the code just doesnt work.
Serial.print("yes");
}
if (x == 0){
Serial.print("no");
}
}
// print the integer
}
Master-
#include<Wire.h>
void setup() {
Wire.begin(); // join i2c bus (address optional for master)
}
byte x = 0;
byte y = 1;
void loop() {
Wire.beginTransmission(8); // transmit to device #8 // sends five bytes
Wire.write(x); // sends one byte
Wire.endTransmission(); // stop transmitting
delay(3000);
Wire.beginTransmission(8); // transmit to device #8 // sends five bytes
Wire.write(y); // sends one byte
Wire.endTransmission(); // stop transmitting
delay(3000);