Demo Program for FTKL-Tagung in November 2016 for HTTP MQTT Requests over ESP

Dependencies:   LM75B mbed

Demo Programm der FTKL-Tagung für die IoT-Kommunikation über die Serielle Schnittstelle mit dem ESP8266-01 und in weiterer Folge Browser-/App-basierende Kommunikation bzw. mittels MQTT.

Anschluss des M0/M3-Boards - M3-ESP-Abbildung:

  • VCC und CH_PD -> VOUT (3,3V) Pin 40
  • GND -> GND Pin 1
  • RX -> TX Pin 9
  • TX -> RX Pin10

/media/uploads/ftkl_user/espanschluss_-small-.png

Files at this revision

API Documentation at this revision

Comitter:
ftkl_user
Date:
Sun Nov 06 15:55:20 2016 +0000
Commit message:
Demo Program for FTKL-Tagung in November 2016 for HTTP MQTT Requests over ESP

Changed in this revision

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.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 539ad965ba5c LM75B.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LM75B.lib	Sun Nov 06 15:55:20 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/chris/code/LM75B/#6a70c9303bbe
diff -r 000000000000 -r 539ad965ba5c main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Nov 06 15:55:20 2016 +0000
@@ -0,0 +1,48 @@
+#include <mbed.h>
+//#include <config.h>   // Bertl
+#include <LM75B.h>
+
+DigitalOut  LedD1(LED1);
+DigitalOut  LedD2(LED2);
+DigitalOut  LedD3(LED3);
+DigitalOut  LedD4(LED4);
+
+//Serial wifi(P1_0, P0_20); // Bertl
+Serial wifi(p9, p10);       // M0
+Serial pc(USBTX, USBRX);
+LM75B sensor(p28, p27);
+
+char str[30];
+
+int main()
+{
+    wifi.printf("Hello M3 MQTT\n");
+
+    while (1) {
+        wifi.scanf("%s", str);
+        //wifi.printf("str: %s\n", str);
+        if(str[0] == 'H' && str[1] == 'L')  // 1. GET--> Serving Requests part in http-server
+            wifi.printf( "HL Msg: %s\n", str);
+        if(str[0] == 'M' && str[1] == 'V')  // 1. GET--> Serving Requests part in http-server
+            ;//Move();                         //    ?reqest=MV
+        else if(str[0] == 'T') {
+            if (str[1] == 'L')
+                ;//TurnLeft();
+            else if (str[1] == 'R')
+                ;//TurnRight();
+        } else {                            // 3. GET--> Serving M0 Board part in http-server
+            if(str[7] == '1')  {             //    ?M0=SD&chan=04&state=1 --> M0_SD_04_1
+                LedD1 = (str[9] -'0');
+                wifi.printf( "LedD1\n");
+            }
+            if(str[7] == '2')
+                LedD2 = (str[9] -'0');
+            if(str[7] == '3')
+                LedD3 = (str[9] -'0');
+            if(str[7] == '4')
+                LedD4 = (str[9] -'0');
+            if(str[3] == 'G')
+                wifi.printf( "Temp: %f\n", sensor.read());
+        }
+    }                                       // 2. GET-->Serving Web Pages for config and reset
+}
\ No newline at end of file
diff -r 000000000000 -r 539ad965ba5c mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Nov 06 15:55:20 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9bcdf88f62b0
\ No newline at end of file