About Arduino Control Voice
La aplicación permite enviar comandos de voz por Bluetooth al Arduino para encender o apagar los puertos digitales o activar secuencias pre-programadas. También puede ser usado por otros Microcontroladores como Raspberry Pi, Pic, AVR, Etc...
Copiar Código al IDE de Arduino:
int estado=1;
void setup(){
Serial.begin(9600);
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);
pinMode(10,OUTPUT);
pinMode(9,OUTPUT);
pinMode(8,OUTPUT);
pinMode(7,OUTPUT);
pinMode(6,OUTPUT);
}
void loop(){
if(Serial.available()>0){
estado = Serial.read();
}
if (estado =='a'){
digitalWrite(13,1);
}
if (estado =='b'){
digitalWrite(13,0);
}
if (estado =='c'){
digitalWrite(12,1);
}
if (estado =='d'){
digitalWrite(12,0);
}
if (estado =='e'){
digitalWrite(11,1);
}
if (estado =='f'){
digitalWrite(11,0);
}
if (estado =='g'){
digitalWrite(10,1);
}
if (estado =='h'){
digitalWrite(10,0);
}
if (estado =='i'){
digitalWrite(9,1);
}
if (estado =='j'){
digitalWrite(9,0);
}
if (estado =='k'){
digitalWrite(8,1);
}
if (estado =='l'){
digitalWrite(8,0);
}
if (estado =='m'){
digitalWrite(7,1);
}
if (estado =='n'){
digitalWrite(7,0);
}
if (estado =='o'){
digitalWrite(6,1);
}
if (estado =='p'){
digitalWrite(6,0);
}
if (estado =='q'){ //all off
digitalWrite(13,0);
digitalWrite(12,0);
digitalWrite(11,0);
digitalWrite(10,0);
digitalWrite(9,0);
digitalWrite(8,0);
digitalWrite(7,0);
digitalWrite(6,0);
}
if (estado =='r'){ // all on
digitalWrite(13,1);
digitalWrite(12,1);
digitalWrite(11,1);
digitalWrite(10,1);
digitalWrite(9,1);
digitalWrite(8,1);
digitalWrite(7,1);
digitalWrite(6,1);
}
if (estado =='s'){ // blink
digitalWrite(13,1);
digitalWrite(12,1);
digitalWrite(11,1);
digitalWrite(10,1);
digitalWrite(9,1);
digitalWrite(8,1);
digitalWrite(7,1);
digitalWrite(6,1);
delay(500);
digitalWrite(13,0);
digitalWrite(12,0);
digitalWrite(11,0);
digitalWrite(10,0);
digitalWrite(9,0);
digitalWrite(8,0);
digitalWrite(7,0);
digitalWrite(6,0);
delay(500);
}
if (estado =='t'){ //Sequence 1
digitalWrite(13,1);
delay(200);
digitalWrite(12,1);
delay(200);
digitalWrite(11,1);
delay(200);
digitalWrite(10,1);
delay(200);
digitalWrite(9,1);
delay(200);
digitalWrite(8,1);
delay(200);
digitalWrite(7,1);
delay(200);
digitalWrite(6,1);
delay(200);
digitalWrite(13,0);
digitalWrite(12,0);
digitalWrite(11,0);
digitalWrite(10,0);
digitalWrite(9,0);
digitalWrite(8,0);
digitalWrite(7,0);
digitalWrite(6,0);
delay(200);
}
if (estado =='u'){ //Sequence 2
}
if (estado =='v'){ //Sequence 3
digitalWrite(13,1);
delay(200);
digitalWrite(13,0);
digitalWrite(12,1);
delay(200);
digitalWrite(12,0);
digitalWrite(11,1);
delay(200);
digitalWrite(11,0);
digitalWrite(10,1);
delay(200);
digitalWrite(10,0);
digitalWrite(9,1);
delay(200);
digitalWrite(9,0);
digitalWrite(8,1);
delay(200);
digitalWrite(8,0);
digitalWrite(7,1);
delay(200);
digitalWrite(7,0);
digitalWrite(6,1);
delay(200);
digitalWrite(6,0);
digitalWrite(7,1);
delay(200);
digitalWrite(7,0);
digitalWrite(8,1);
delay(200);
digitalWrite(8,0);
digitalWrite(9,1);
delay(200);
digitalWrite(9,0);
digitalWrite(10,1);
delay(200);
digitalWrite(10,0);
digitalWrite(11,1);
delay(200);
digitalWrite(11,0);
digitalWrite(12,1);
delay(200);
digitalWrite(12,0);
}
} The application allows you to send voice commands to Arduino Bluetooth on or off the digital ports or activate pre-programmed sequences. It can also be used by other microcontrollers as Raspberry Pi, Pic, AVR, etc ...
Copy code to Arduino:
int status = 1;
void setup () {
Serial.begin (9600);
pinMode (13, OUTPUT);
pinMode (12, OUTPUT);
pinMode (11, OUTPUT);
pinMode (10, OUTPUT);
pinMode (9, OUTPUT);
pinMode (8, OUTPUT);
pinMode (7, OUTPUT);
pinMode (6, OUTPUT);
}
void loop () {
if (Serial.available ()> 0) {
status = Serial.read ();
}
if (state == 'a') {
digitalWrite (13.1);
}
if (state == 'b') {
digitalWrite (13.0);
}
if (state == 'c') {
digitalWrite (12.1);
}
if (state == 'd') {
digitalWrite (12.0);
}
if (state == 'e') {
digitalWrite (11.1);
}
if (state == 'f') {
digitalWrite (11.0);
}
if (state == 'g') {
digitalWrite (10.1);
}
if (state == 'h') {
digitalWrite (10.0);
}
if (state == 'i') {
digitalWrite (9.1);
}
if (state == 'j') {
digitalWrite (9.0);
}
if (state == 'k') {
digitalWrite (8.1);
}
if (state == 'l') {
digitalWrite (8.0);
}
if (state == 'm') {
digitalWrite (7.1);
}
if (state == 'n') {
digitalWrite (7.0);
}
if (state == 'or') {
digitalWrite (6.1);
}
if (state == 'p') {
digitalWrite (6.0);
}
if (state == 'q') {// all off
digitalWrite (13.0);
digitalWrite (12.0);
digitalWrite (11.0);
digitalWrite (10.0);
digitalWrite (9.0);
digitalWrite (8.0);
digitalWrite (7.0);
digitalWrite (6.0);
}
if (state == 'r') {// all on
digitalWrite (13.1);
digitalWrite (12.1);
digitalWrite (11.1);
digitalWrite (10.1);
digitalWrite (9.1);
digitalWrite (8.1);
digitalWrite (7.1);
digitalWrite (6.1);
}
if (state == 's') {// blink
digitalWrite (13.1);
digitalWrite (12.1);
digitalWrite (11.1);
digitalWrite (10.1);
digitalWrite (9.1);
digitalWrite (8.1);
digitalWrite (7.1);
digitalWrite (6.1);
delay (500);
digitalWrite (13.0);
digitalWrite (12.0);
digitalWrite (11.0);
digitalWrite (10.0);
digitalWrite (9.0);
digitalWrite (8.0);
digitalWrite (7.0);
digitalWrite (6.0);
delay (500);
}
if (state == 't') {// Sequence 1
digitalWrite (13.1);
delay (200);
digitalWrite (12.1);
delay (200);
digitalWrite (11.1);
delay (200);
digitalWrite (10.1);
delay (200);
digitalWrite (9.1);
delay (200);
digitalWrite (8.1);
delay (200);
digitalWrite (7.1);
delay (200);
digitalWrite (6.1);
delay (200);
digitalWrite (13.0);
digitalWrite (12.0);
digitalWrite (11.0);
digitalWrite (10.0);
digitalWrite (9.0);
digitalWrite (8.0);
digitalWrite (7.0);
digitalWrite (6.0);
delay (200);
}
if (state == 'u') {// Sequence 2
}
if (state == 'v') {// Sequence 3
digitalWrite (13.1);
delay (200);
digitalWrite (13.0);
digitalWrite (12.1);
delay (200);
digitalWrite (12.0);
digitalWrite (11.1);
delay (200);
digitalWrite (11.0);
digitalWrite (10.1);
delay (200);
digitalWrite (10.0);
digitalWrite (9.1);
delay (200);
digitalWrite (9.0);
digitalWrite (8.1);
delay (200);
digitalWrite (8.0);
digitalWrite (7.1);
delay (200);
digitalWrite (7.0);
digitalWrite (6.1);
delay (200);
digitalWrite (6.0);
digitalWrite (7.1);
delay (200);
digitalWrite (7.0);
digitalWrite (8.1);
delay (200);
digitalWrite (8.0);
digitalWrite (9.1);
delay (200);
digitalWrite (9.0);
digitalWrite (10.1);
delay (200);
digitalWrite (10.0);
digitalWrite (11.1);
delay (200);
digitalWrite (11.0);
digitalWrite (12.1);
delay (200);
digitalWrite (12.0);
}
}
by Q####:
Good