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 2:cd043c95f930, committed 2015-10-05
- Comitter:
- tony63
- Date:
- Mon Oct 05 01:46:02 2015 +0000
- Parent:
- 1:d0a4ddc1bd88
- Commit message:
- lee un voltaje y lo manda por serial al modulo bluetooth. la aplicacion es de app inventor VOLTAJE1
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 |
--- a/main.cpp Fri Apr 17 19:58:59 2015 +0000
+++ b/main.cpp Mon Oct 05 01:46:02 2015 +0000
@@ -5,34 +5,30 @@
#include "mbed.h"
#include <stdio.h>
-//#include <conio.h>
-DigitalOut LedVerde(LED2);
-DigitalOut LedRojo(LED1);
-DigitalOut LedAzul(LED3);
-
-Serial GSM(PTE0,PTE1); //puertos del FRDM para el modem
+Serial usart(PTE0,PTE1); //puertos del FRDM para el modem
Serial pc(USBTX,USBRX);
-int med,num,i,j,k;
-AnalogIn input(PTC2);
+int med,num,j,k;
+float medir;
+AnalogIn volt(PTB2);
int main(void)
{
- GSM.baud(9600); // asigno baudios y configuro puerto serie de la usart
- GSM.format(8,Serial::None,1);
+ usart.baud(9600); // asigno baudios y configuro puerto serie de la usart
+ usart.format(8,Serial::None,1);
while(1){
- med = input.read(); //leo puerto analogico
- wait(0.5);
- num = med*1000; //agrando el numero de cero a mil
+ medir = volt.read(); //leo puerto analogico
+ wait(0.3);
+ num = medir*1000; //agrando el numero de cero a mil
if(num<256){ //debo generar dos casos a APP inventor solo me recibe hex asi: 0xhhhh (4 cifras)
- GSM.putc(0); //si el numero es hasta 255 se le ponen dos ceros adelante a la secuencia de bits
- GSM.putc(i); //luego la cifra menos significativa
+ usart.putc(0); //si el numero es hasta 255 se le ponen dos ceros adelante a la secuencia de bits
+ usart.putc(num); //luego la cifra menos significativa
}
if(num>255){ //pero si es mayor a 255 las cifras deben ser convertidas a un hex de dos bytes de la siguiente forma
j=num/256; //calculo la cifra mas significativa
k=num-j*256; //calculo la cifra menos significativa
- GSM.putc(j); //las envio a la usart para que se las ponga al modulo bluetooth y la lleve al android
- GSM.putc(k); //mas significativa primero, menos despues si no no funciona!!! y con la orden PUTC solo asi le envia binarios
+ usart.putc(j); //las envio a la usart para que se las ponga al modulo bluetooth y la lleve al android
+ usart.putc(k); //mas significativa primero, menos despues si no no funciona!!! y con la orden PUTC solo asi le envia binarios
}
}
}
\ No newline at end of file
--- a/mbed.bld Fri Apr 17 19:58:59 2015 +0000 +++ b/mbed.bld Mon Oct 05 01:46:02 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file