bonjour
je suis tombé sur ça
Par "saine" curiosité j'ai testé avec un HC06 , et le soft avec un vieux galaxy ACE sous android 2.2.1 et j'avoue que je suis assez "bluffé" , la reconnaissance du "français" est plutot bien supportée.
J'ai un peu modifié le sketch arduino , pour y incorporer un peu de français, le HC06 en software serial , une duplication "de la reconnaissance" sur le serial monitor et l'utilisation de la led13 pour simple test.
.
//Coded By: Angelo Casimiro (4/27/14)
//Voice Activated Arduino (Bluetooth + Android)
//Feel free to modify it but remember to give credit
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(2, 3); // RX | TX HC06 sur software serial
// RX arduino <--- TXD cible
// TX arduino ---> RXD cible
String voice;
int
led1 = 13, //Connect LED 1 To Pin #13 on board arduino
led2 = 4, //Connect LED 2 To Pin #4
led3 = 5, //Connect LED 3 To Pin #5
led4 = 6, //Connect LED 4 To Pin #6
led5 = 7; //Connect LED 5 To Pin #7
//--------------------------Call A Function-------------------------------//
void allon(){
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
}
void alloff(){
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
}
//-----------------------------------------------------------------------//
void setup() {
Serial.begin(9600);
BTSerial.begin(9600); // vitesse software serial
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
}
//-----------------------------------------------------------------------//
void loop() {
while (BTSerial.available()){ //Check if there is an available byte to read
delay(10); //Delay added to make thing stable
char c = BTSerial.read(); //Conduct a serial read
if (c == '#') {break;} //Exit the loop when the # is detected after the word
voice += c; //Shorthand for voice = voice + c
}
if (voice.length() > 0) {
Serial.println(voice); // duplication du VR sur le serial monitor
//-----------------------------------------------------------------------//
//----------Control Multiple Pins/ LEDs----------//
if(voice == "*all on") {allon();} //Turn Off All Pins (Call Function)
else if(voice == "*stopper tout"){alloff();} //Turn On All Pins (Call Function)
//----------Turn On One-By-One----------//
else if(voice == "*allumer 13") {digitalWrite(led1, HIGH);}
else if(voice == "*fan on") {digitalWrite(led2, HIGH);}
else if(voice == "*computer on") {digitalWrite(led3, HIGH);}
else if(voice == "*bedroom lights on") {digitalWrite(led4, HIGH);}
else if(voice == "*bathroom lights on") {digitalWrite(led5, HIGH);}
//----------Turn Off One-By-One----------//
else if(voice == "*stop 13") {digitalWrite(led1, LOW);}
else if(voice == "*fan off") {digitalWrite(led2, LOW);}
else if(voice == "*computer off") {digitalWrite(led3, LOW);}
else if(voice == "*bedroom lights off") {digitalWrite(led4, LOW);}
else if(voice == "*bathroom lights off") {digitalWrite(led5, LOW);}
//-----------------------------------------------------------------------//
voice="";}} //Reset the variable after initiating