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
AT&T M2M Mobile App Hackathon
- DFW 09-14 & 09-15
- Attendee List
- API Details
- Winning team pitches idea to ATT Executives on Tuesday 09-17-2013
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
- low use. No wifly modules and little/no wired Ethernet
- ATT Github page with arduino stuff
- 2lemetry
- MSFT
- One group hacked on windows phone, rest on android / iphone
- Most were HTML5 (better looking ones)
Pictures from the Event
Diff: main.cpp
- Revision:
- 3:71cb394cbb32
- Parent:
- 2:270e2d0bb85a
- Child:
- 4:1ec9d1243e8b
--- a/main.cpp Thu Aug 30 15:42:06 2012 +0000 +++ b/main.cpp Sun Sep 15 15:36:13 2013 +0000 @@ -1,30 +1,79 @@ #include "mbed.h" + +// Ethernet #include "EthernetInterface.h" #include "HTTPClient.h" - EthernetInterface eth; HTTPClient http; char str[512]; -int main() +//LCD +#include "C12832_lcd.h" +C12832_LCD lcd; + +// joystick pins and LED +BusIn joystick(p15,p12,p13,p16); +DigitalIn enter(p14); +BusOut led(LED1,LED2,LED3,LED4); +Ticker joystick_to_led; +void joystickHandler(void){ led = (enter) ? 0xf : joystick; } + +// Accelerometer +#include "MMA7660.h" +MMA7660 accelerometer(p28, p27); + +// RGB LED +PwmOut r(p23); +PwmOut g(p24); +PwmOut b(p25); + +// Temp sensor +#include "LM75B.h" +LM75B temp(p28,p27); + +int main() { - eth.init(); //Use DHCP + joystick_to_led.attach(&joystickHandler, 0.001f); + lcd.printf ("Bootstrap Complete!\n"); + + while(1) + { + lcd.locate(8,10); + //lcd.printf("Temp: %.1fC", temp.read()); + lcd.printf("Temp: %.1fF", (temp.read()+32*(9/5))); + + lcd.locate(8,20); + lcd.printf("X: %.1f Y:%.1f Z:%.1f\n", accelerometer.x(), accelerometer.y(), accelerometer.z()); + + r = 1.0f - accelerometer.x(); + g = 1.0f - accelerometer.y(); + b = 1.0f - accelerometer.z(); + + led = (enter) ? 0xf : joystick; + } + + // Prepare to use DHCP + if (0 != eth.init()){ + error("Init Failed\n"); + } + // Try to get an IPAddress + if (0 != eth.connect()){ + error("Connect Failed:\n"); + } + // Now we are part of the network + printf("IP Address: %s\n", eth.getIPAddress()); - eth.connect(); - //GET data printf("\nTrying to fetch page...\n"); - int ret = http.get("http://mbed.org/media/uploads/donatien/hello.txt", str, 128); - if (!ret) - { - printf("Page fetched successfully - read %d characters\n", strlen(str)); - printf("Result: %s\n", str); + int ret = http.get("http://mbed.org/media/uploads/donatien/hello.txt", str, 512); +// int ret = http.get("http://mbed.org/", str, 512); + if (!ret) { + printf("Page fetched successfully - read %d characters\n", strlen(str)); + printf("Result: %s\n", str); + } else { + printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode()); } - else - { - printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode()); - } - + //POST data HTTPMap map; HTTPText inText(str, 512); @@ -32,47 +81,38 @@ map.put("test", "1234"); printf("\nTrying to post data...\n"); ret = http.post("http://httpbin.org/post", map, &inText); - if (!ret) - { - printf("Executed POST successfully - read %d characters\n", strlen(str)); - printf("Result: %s\n", str); + if (!ret) { + printf("Executed POST successfully - read %d characters\n", strlen(str)); + printf("Result: %s\n", str); + } else { + printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode()); } - else - { - printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode()); - } - + //PUT data strcpy(str, "This is a PUT test!"); HTTPText outText(str); //HTTPText inText(str, 512); printf("\nTrying to put resource...\n"); ret = http.put("http://httpbin.org/put", outText, &inText); - if (!ret) - { - printf("Executed PUT successfully - read %d characters\n", strlen(str)); - printf("Result: %s\n", str); + if (!ret) { + printf("Executed PUT successfully - read %d characters\n", strlen(str)); + printf("Result: %s\n", str); + } else { + printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode()); } - else - { - printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode()); - } - + //DELETE data //HTTPText inText(str, 512); printf("\nTrying to delete resource...\n"); ret = http.del("http://httpbin.org/delete", &inText); - if (!ret) - { - printf("Executed DELETE successfully - read %d characters\n", strlen(str)); - printf("Result: %s\n", str); + if (!ret) { + printf("Executed DELETE successfully - read %d characters\n", strlen(str)); + printf("Result: %s\n", str); + } else { + printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode()); } - else - { - printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode()); - } - - eth.disconnect(); + + eth.disconnect(); while(1) { }