Alexander Lang
/
Genie_Test_Temperature
a quick program to test the 4Dgenie library
Fork of Genie_Test by
Diff: main.cpp
- Revision:
- 3:4fe144f2f64e
- Parent:
- 2:e0f7812d4524
- Child:
- 4:5e14a065031d
--- a/main.cpp Wed Nov 20 22:47:46 2013 +0000 +++ b/main.cpp Sat Dec 07 02:34:40 2013 +0000 @@ -1,20 +1,6 @@ #include "mbed.h" #include "mbed_genie.h" -#include "WiflyInterface.h" -/* - For Now, the 4d Screen Genie is hard coded to operate on the uart connected at pins p9 and p10 - Further improvements would be to make to turn it into a class that could be instantiated to any - or the Mbed uarts -> TODO -*/ -/* wifly object where: -* - p13 and p14 are for the serial communication -* - p25 is for the reset pin -* - p26 is for the connection status -* - "mbed" is the ssid of the network -* - "password" is the password -* - WPA is the security -*/ -WiflyInterface wifly(p13, p14, p25, p26, "Bibite", "DIR825Chris24", WPA); + DigitalOut myled(LED1); void myGenieEventHandler(void) { @@ -23,6 +9,10 @@ //event report from an object if(Event.reportObject.cmd == GENIE_REPORT_EVENT) { + /* + for example here we check if we received a message from 4dbuttons objects + the index is the button number, refer to the 4dgenie project to know the index + */ if (Event.reportObject.object == GENIE_OBJ_4DBUTTON) // If the Reported Message was from a Slider { if (Event.reportObject.index == 0) @@ -49,28 +39,33 @@ } int main() { + int temp = 0; + SetupGenie(); genieAttachEventHandler(&myGenieEventHandler); genieWriteContrast(0); -wifly.init(); // use DHCP -while (!wifly.connect()); // join the network - printf("IP Address is %s\n\r", wifly.getIPAddress()); printf("Mbed Genie demo \n\r"); genieWriteContrast(1); -//Write a string to the Display - genieWriteStr(0, __DATE__" " __TIME__); - genieWriteStr(1, wifly.getIPAddress()); - genieWriteStr(2, "Mbed Genie Test and developement"); - + /* + for example, in this loop we increment the thermometer0 object from 0 to 100 + */ while(1) { - + if(temp >= 100) + { + temp = 0; + } + else + { + temp++; + } + genieWriteObject(GENIE_OBJ_THERMOMETER,0,temp); myled = 1; - wait(0.2); + wait(0.25); myled = 0; - wait(0.2); + wait(0.25); } }