Leonardo Menxa / Mbed 2 deprecated Clase14

Dependencies:   SoftSerial TextLCD mbed

Fork of String_BT by Marvin Villamizar

Files at this revision

API Documentation at this revision

Comitter:
dimmu8410
Date:
Sat Oct 22 14:31:01 2016 +0000
Child:
1:34f5a73ebf6c
Commit message:
oK.oK

Changed in this revision

SoftSerial.lib Show annotated file Show diff for this revision Revisions of this file
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/SoftSerial.lib	Sat Oct 22 14:31:01 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/Sissors/code/SoftSerial/#236fce2e5b8c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Oct 22 14:31:01 2016 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+#include "SoftSerial.h"
+#include <string>
+int ledPin = 13;
+string readString;
+char c[125];
+AnalogIn ai(A0);
+float measure;
+SoftSerial BT(D2,D3);
+Serial pc(USBTX,USBRX);
+DigitalOut led(LED2);
+
+int main() 
+{
+  pc.baud(9600);
+  BT.baud(9600);
+  while(1)
+  {
+   while (BT.readable()>0) 
+   {
+    wait(0.003);  
+    //char c = BT.getC();
+    BT.gets(c,3);
+    readString += c; 
+  }
+  if (readString.length()>0) 
+  {
+    pc.printf("%s\r\n",readString);
+    if (readString == "NO")     
+    {
+      led=1;
+    }
+    if (readString == "FO")
+    {
+      led=0;
+    }
+    if (readString == "AL")
+    {
+      measure=ai.read_u16()*0.00005;
+      BT.printf("%f",measure);
+    }
+    readString="";
+    
+  } 
+}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Oct 22 14:31:01 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/c0f6e94411f5
\ No newline at end of file