ser_project

Dependencies:   4DGL-uLCD-SE C12832 LM75B mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
kvothe345
Date:
Thu May 19 10:36:23 2016 +0000
Commit message:
ola

Changed in this revision

4DGL-uLCD-SE.lib Show annotated file Show diff for this revision Revisions of this file
C12832.lib Show annotated file Show diff for this revision Revisions of this file
LM75B.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-rtos.lib 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/4DGL-uLCD-SE.lib	Thu May 19 10:36:23 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/4180_1/code/4DGL-uLCD-SE/#e39a44de229a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832.lib	Thu May 19 10:36:23 2016 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/chris/code/C12832/#7de323fa46fe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LM75B.lib	Thu May 19 10:36:23 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/neilt6/code/LM75B/#fc27dc535ea9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 19 10:36:23 2016 +0000
@@ -0,0 +1,121 @@
+#include "mbed.h"
+#include "C12832.h"
+#include "LM75B.h"
+
+
+
+//------------------------------------------------------------------------//
+// Hardware Variables                                                     //
+//------------------------------------------------------------------------//
+Serial      rn41    (p9,p10);
+Serial      pc      (USBTX,USBRX);
+C12832      lcd     (p5, p7, p6, p8, p11);
+LM75B       sensor  (p28,p27);
+//BusOut      led     (LED4,LED3,LED2,LED1);
+DigitalOut  led1    (LED1);
+DigitalOut  led2    (LED2);
+DigitalOut  led3    (LED3);
+DigitalOut  led4    (LED4);
+AnalogIn    pot(p19);
+AnalogIn    pot2(p20);
+
+
+//------------------------------------------------------------------------//
+// Function Headears                                                      //
+//------------------------------------------------------------------------//
+void    bluetoothReceive    ();
+void    setupBluetooth      ();
+
+
+char buff[100];
+
+//------------------------------------------------------------------------//
+// Functions                                                              //
+//------------------------------------------------------------------------//
+
+float read_temp()
+{
+
+    if (sensor.open()) {
+        printf("Device detected!\n");
+
+        while (1) {
+            lcd.cls();
+            lcd.locate(0,3);
+            lcd.printf("Temp = %.3f\n", (float)sensor);
+            return sensor;
+        }
+    } else {
+        error("Device not detected!\n");
+        return -1;
+    }
+
+}
+
+
+
+void bluetoothReceive   ()
+{
+    char caracter;
+    float t;
+
+    memset (buff,'\0',sizeof(buff));
+    lcd.locate(10,15);
+    lcd.printf(": wait msg");
+    while (rn41.readable()) {
+        caracter = rn41.getc();
+        rn41.putc(caracter);
+        buff[strlen(buff)]= caracter;
+        led3 = 1;
+    }
+    lcd.locate(10,15);
+    lcd.printf(": %s",buff);
+    led1 = 0;
+    if(buff[0] == 't') {
+        led2 = 1;
+        t = read_temp();
+        caracter = t;
+        rn41.putc(caracter);
+    }
+}
+
+void setupBluetooth     ()
+{
+        lcd.locate(10,15);
+    lcd.printf(": setu");
+    rn41.baud(115200);
+    rn41.format(8,SerialBase::None,1);
+    rn41.attach(&bluetoothReceive, Serial::RxIrq);
+}
+
+
+//void executing_thread(){
+
+
+
+
+//}
+
+
+
+//------------------------------------------------------------------------//
+// Main                                                                   //
+//------------------------------------------------------------------------//
+int main()
+{
+    memset (buff,'\0',sizeof(buff));
+    lcd.cls();
+
+    setupBluetooth();
+    //Thread executing(executing_thread);
+
+    pc.baud(9600);
+
+    lcd.cls();
+    lcd.locate(0,3);
+    lcd.printf("I'm the MBED board!");
+    led1=1;
+
+
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Thu May 19 10:36:23 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#11950e007d8a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 19 10:36:23 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/87f2f5183dfb
\ No newline at end of file