Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:ecf36596f7a6, committed 2017-11-20
- Comitter:
- Christianh
- Date:
- Mon Nov 20 21:10:03 2017 +0000
- Commit message:
- Reconoce comandos de voz enviados desde el celular
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Nov 20 21:10:03 2017 +0000
@@ -0,0 +1,80 @@
+
+#include "mbed.h"
+
+//DigitalOut myled(LED_GREEN); //Parpadear led;
+Serial pc(USBTX, USBRX); //Configurar salida serial para PC;
+AnalogIn volt(PTB2); //Configirar puerto análogo;
+Serial bt(PTE0,PTE1); //puertos del FRDM para el modem bluetooth;
+PwmOut PWM1(PTB3); //Configuro una salida PWM;
+DigitalOut ledR(LED1);
+DigitalOut ledV(LED2);
+DigitalOut ledA(LED3);
+
+
+
+int main()
+{
+ bt.baud(9600); // asigno baudios y configuro puerto serie de la usart
+ bt.format(8,Serial::None,1); //8bits - No parity bit - one stop bit
+ //int nu ;
+ //int v;
+
+ int lectura ; //Variable para leer desde el BT
+ //int v= (int)floor(lectura);
+
+ //float p;
+
+
+ //int comando=0; //Variable que usaré para saber qué parámetro está siendo enviado;
+ pc.printf("Reconocimiento de voz\n");
+
+ while (1)
+ { //Loop...
+
+
+ //Leer información del bluetooth
+ if (bt.readable())
+ {
+
+ lectura = bt.getc(); //Leo el valor del bluetooth;
+
+
+ //pc.printf("caracter %i\n", lectura);
+ //int v= (int)(lectura); //convierte en entero
+ //pc.printf("numero %i\n", v);
+ wait(0.4);
+
+ if (lectura==1){
+ pc.printf("color AZUL\n");
+ ledA=0;
+ ledR=1;
+ ledV=1;
+
+ }
+
+ if (lectura==2){
+ pc.printf("color ROJO\n");
+ ledA=1;
+ ledR=0;
+ ledV=1;
+
+ }
+
+ if (lectura==3){
+ pc.printf("color VERDE\n");
+ ledA=1;
+ ledR=1;
+ ledV=0;
+ }
+
+
+
+ }
+
+
+
+
+ }
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Nov 20 21:10:03 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/fb8e0ae1cceb \ No newline at end of file