mbed application board program with most libraries pulled in to create a feature rich starting point for hackathons

Dependencies:   C12832_lcd EthernetInterface HTTPClient LM75B MMA7660 mbed-rtos mbed

Fork of HTTPClient_HelloWorld by Donatien Garnier

AT&T M2M Mobile App Hackathon

Team's Project Pitch Notes

  • Car location and tracking system (GPS + Wifi + Cellular)
  • Temperature / auto vent control for home and industrial use (cellular + servo)
  • GPS triangulation (sonar + cellular)
  • Emergency Tool (Low cost OnStar / Sync Emergency Assistance)
  • Remote Video Conference: Tele-presense (cellular and buttons. Rest was web services)
  • M2M Billboard (LED + Cellular)
  • Order management (restaurants) - Interrupt driven service. Not polled by wait staff (level sensor and cellular)
  • pool manager (simulated ph and chem readings -> cellular)
  • sprest - learning electronic sprinkler system (simulated moisture and weather readings -> cellular)
  • safe traffic signals: stoprite (lots of statistics, used buttons and toy cars to create a scenario)
  • Ecosense

Keywords Used Frequently During Presentation

  • real-time
  • MQTT
  • Arduino
  • 2lemetry
  • HTML5
  • Big data
  • Server side

Participants

  • ARM mbed
  • 2lemetry
  • MSFT
    • One group hacked on windows phone, rest on android / iphone
    • Most were HTML5 (better looking ones)

Pictures from the Event

Committer:
atthackathon
Date:
Sun Sep 15 15:36:13 2013 +0000
Revision:
3:71cb394cbb32
Parent:
2:270e2d0bb85a
Child:
4:1ec9d1243e8b
Pulling in all sensor and libraries for the application board

Who changed what in which revision?

UserRevisionLine numberNew contents of line
donatien 0:0e0debc29569 1 #include "mbed.h"
atthackathon 3:71cb394cbb32 2
atthackathon 3:71cb394cbb32 3 // Ethernet
donatien 0:0e0debc29569 4 #include "EthernetInterface.h"
donatien 0:0e0debc29569 5 #include "HTTPClient.h"
donatien 1:d263603373ac 6 EthernetInterface eth;
donatien 1:d263603373ac 7 HTTPClient http;
donatien 1:d263603373ac 8 char str[512];
donatien 1:d263603373ac 9
atthackathon 3:71cb394cbb32 10 //LCD
atthackathon 3:71cb394cbb32 11 #include "C12832_lcd.h"
atthackathon 3:71cb394cbb32 12 C12832_LCD lcd;
atthackathon 3:71cb394cbb32 13
atthackathon 3:71cb394cbb32 14 // joystick pins and LED
atthackathon 3:71cb394cbb32 15 BusIn joystick(p15,p12,p13,p16);
atthackathon 3:71cb394cbb32 16 DigitalIn enter(p14);
atthackathon 3:71cb394cbb32 17 BusOut led(LED1,LED2,LED3,LED4);
atthackathon 3:71cb394cbb32 18 Ticker joystick_to_led;
atthackathon 3:71cb394cbb32 19 void joystickHandler(void){ led = (enter) ? 0xf : joystick; }
atthackathon 3:71cb394cbb32 20
atthackathon 3:71cb394cbb32 21 // Accelerometer
atthackathon 3:71cb394cbb32 22 #include "MMA7660.h"
atthackathon 3:71cb394cbb32 23 MMA7660 accelerometer(p28, p27);
atthackathon 3:71cb394cbb32 24
atthackathon 3:71cb394cbb32 25 // RGB LED
atthackathon 3:71cb394cbb32 26 PwmOut r(p23);
atthackathon 3:71cb394cbb32 27 PwmOut g(p24);
atthackathon 3:71cb394cbb32 28 PwmOut b(p25);
atthackathon 3:71cb394cbb32 29
atthackathon 3:71cb394cbb32 30 // Temp sensor
atthackathon 3:71cb394cbb32 31 #include "LM75B.h"
atthackathon 3:71cb394cbb32 32 LM75B temp(p28,p27);
atthackathon 3:71cb394cbb32 33
atthackathon 3:71cb394cbb32 34 int main()
donatien 0:0e0debc29569 35 {
atthackathon 3:71cb394cbb32 36 joystick_to_led.attach(&joystickHandler, 0.001f);
atthackathon 3:71cb394cbb32 37 lcd.printf ("Bootstrap Complete!\n");
atthackathon 3:71cb394cbb32 38
atthackathon 3:71cb394cbb32 39 while(1)
atthackathon 3:71cb394cbb32 40 {
atthackathon 3:71cb394cbb32 41 lcd.locate(8,10);
atthackathon 3:71cb394cbb32 42 //lcd.printf("Temp: %.1fC", temp.read());
atthackathon 3:71cb394cbb32 43 lcd.printf("Temp: %.1fF", (temp.read()+32*(9/5)));
atthackathon 3:71cb394cbb32 44
atthackathon 3:71cb394cbb32 45 lcd.locate(8,20);
atthackathon 3:71cb394cbb32 46 lcd.printf("X: %.1f Y:%.1f Z:%.1f\n", accelerometer.x(), accelerometer.y(), accelerometer.z());
atthackathon 3:71cb394cbb32 47
atthackathon 3:71cb394cbb32 48 r = 1.0f - accelerometer.x();
atthackathon 3:71cb394cbb32 49 g = 1.0f - accelerometer.y();
atthackathon 3:71cb394cbb32 50 b = 1.0f - accelerometer.z();
atthackathon 3:71cb394cbb32 51
atthackathon 3:71cb394cbb32 52 led = (enter) ? 0xf : joystick;
atthackathon 3:71cb394cbb32 53 }
atthackathon 3:71cb394cbb32 54
atthackathon 3:71cb394cbb32 55 // Prepare to use DHCP
atthackathon 3:71cb394cbb32 56 if (0 != eth.init()){
atthackathon 3:71cb394cbb32 57 error("Init Failed\n");
atthackathon 3:71cb394cbb32 58 }
atthackathon 3:71cb394cbb32 59 // Try to get an IPAddress
atthackathon 3:71cb394cbb32 60 if (0 != eth.connect()){
atthackathon 3:71cb394cbb32 61 error("Connect Failed:\n");
atthackathon 3:71cb394cbb32 62 }
atthackathon 3:71cb394cbb32 63 // Now we are part of the network
atthackathon 3:71cb394cbb32 64 printf("IP Address: %s\n", eth.getIPAddress());
donatien 0:0e0debc29569 65
donatien 0:0e0debc29569 66 //GET data
donatien 2:270e2d0bb85a 67 printf("\nTrying to fetch page...\n");
atthackathon 3:71cb394cbb32 68 int ret = http.get("http://mbed.org/media/uploads/donatien/hello.txt", str, 512);
atthackathon 3:71cb394cbb32 69 // int ret = http.get("http://mbed.org/", str, 512);
atthackathon 3:71cb394cbb32 70 if (!ret) {
atthackathon 3:71cb394cbb32 71 printf("Page fetched successfully - read %d characters\n", strlen(str));
atthackathon 3:71cb394cbb32 72 printf("Result: %s\n", str);
atthackathon 3:71cb394cbb32 73 } else {
atthackathon 3:71cb394cbb32 74 printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
donatien 0:0e0debc29569 75 }
atthackathon 3:71cb394cbb32 76
donatien 0:0e0debc29569 77 //POST data
donatien 0:0e0debc29569 78 HTTPMap map;
donatien 2:270e2d0bb85a 79 HTTPText inText(str, 512);
donatien 0:0e0debc29569 80 map.put("Hello", "World");
donatien 0:0e0debc29569 81 map.put("test", "1234");
donatien 2:270e2d0bb85a 82 printf("\nTrying to post data...\n");
donatien 2:270e2d0bb85a 83 ret = http.post("http://httpbin.org/post", map, &inText);
atthackathon 3:71cb394cbb32 84 if (!ret) {
atthackathon 3:71cb394cbb32 85 printf("Executed POST successfully - read %d characters\n", strlen(str));
atthackathon 3:71cb394cbb32 86 printf("Result: %s\n", str);
atthackathon 3:71cb394cbb32 87 } else {
atthackathon 3:71cb394cbb32 88 printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
donatien 0:0e0debc29569 89 }
atthackathon 3:71cb394cbb32 90
donatien 2:270e2d0bb85a 91 //PUT data
donatien 2:270e2d0bb85a 92 strcpy(str, "This is a PUT test!");
donatien 2:270e2d0bb85a 93 HTTPText outText(str);
donatien 2:270e2d0bb85a 94 //HTTPText inText(str, 512);
donatien 2:270e2d0bb85a 95 printf("\nTrying to put resource...\n");
donatien 2:270e2d0bb85a 96 ret = http.put("http://httpbin.org/put", outText, &inText);
atthackathon 3:71cb394cbb32 97 if (!ret) {
atthackathon 3:71cb394cbb32 98 printf("Executed PUT successfully - read %d characters\n", strlen(str));
atthackathon 3:71cb394cbb32 99 printf("Result: %s\n", str);
atthackathon 3:71cb394cbb32 100 } else {
atthackathon 3:71cb394cbb32 101 printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
donatien 2:270e2d0bb85a 102 }
atthackathon 3:71cb394cbb32 103
donatien 2:270e2d0bb85a 104 //DELETE data
donatien 2:270e2d0bb85a 105 //HTTPText inText(str, 512);
donatien 2:270e2d0bb85a 106 printf("\nTrying to delete resource...\n");
donatien 2:270e2d0bb85a 107 ret = http.del("http://httpbin.org/delete", &inText);
atthackathon 3:71cb394cbb32 108 if (!ret) {
atthackathon 3:71cb394cbb32 109 printf("Executed DELETE successfully - read %d characters\n", strlen(str));
atthackathon 3:71cb394cbb32 110 printf("Result: %s\n", str);
atthackathon 3:71cb394cbb32 111 } else {
atthackathon 3:71cb394cbb32 112 printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
donatien 2:270e2d0bb85a 113 }
atthackathon 3:71cb394cbb32 114
atthackathon 3:71cb394cbb32 115 eth.disconnect();
donatien 0:0e0debc29569 116
donatien 0:0e0debc29569 117 while(1) {
donatien 0:0e0debc29569 118 }
donatien 0:0e0debc29569 119 }