Hello All,
I am doing one project using TTS library. I download one code from the internet
#include "Talkie.h"
#include "Vocab_US_Large.h"
//THE SCREWDRIVER
Talkie voice;
void setup() {
voice.say(sp2_DANGER);
voice.say(sp2_DANGER);
voice.say(sp2_RED);
voice.say(sp2_ALERT);
voice.say(sp2_MOTOR);
voice.say(sp2_IS);
voice.say(sp2_ON);
voice.say(sp2_FIRE);
// SUBSCRIBE TO THE SCREWDRIVER https://www.youtube.com/channel/UCk9UflimfCIAv7kdAWBxyuA
}
void loop() {
}
Above code work properly. but i am doing some modification on this code shown below
#include <Wire.h>
#include "Talkie.h"
#include "Vocab_US_Large.h"
//THE SCREWDRIVER
Talkie voice;
char charValue[4];
void setup()
{
Wire.begin();
Serial.begin(9600);
}
void loop()
{
// This is using address 0x6 which can be changed in the device settings.
Wire.requestFrom(0x66, 2);
if (Wire.available() >= 2)
{
int byteH = Wire.read();
int byteL = Wire.read();
float distanceInCM = byteH * 256 + byteL;
float distanceInMeter = (distanceInCM/100);
dtostrf(distanceInMeter,4,1,charValue);
voice.say(sp2_DISTANCE);
voice.say(sp2_IS);
voice.say(sp2_charValue);
voice.say(sp2_METER);
}
delay(100);
}
In modified code have some issues I am not able to resolve these issues. In this code, I have accruing sensor data and converted it into character and try to listen "DISTANCE IS 4 METER". But not get success.
So please help me with what can I change in the above code.