![](/media/cache/profiles/06833b73c7b85d172f55b6f38a40b094.jpg.50x50_q85.jpg)
a quick program to test the 4Dgenie library
Fork of Genie_Test by
main.cpp
- Committer:
- chris215
- Date:
- 2013-11-20
- Revision:
- 2:e0f7812d4524
- Parent:
- 1:203466f6d54f
- Child:
- 3:4fe144f2f64e
File content as of revision 2:e0f7812d4524:
#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) { genieFrame Event; genieDequeueEvent(&Event); //event report from an object if(Event.reportObject.cmd == GENIE_REPORT_EVENT) { if (Event.reportObject.object == GENIE_OBJ_4DBUTTON) // If the Reported Message was from a Slider { if (Event.reportObject.index == 0) { printf("Button 1 pressed!\n\r"); } if (Event.reportObject.index == 1) { printf("Button 2 pressed!\n\r"); } if (Event.reportObject.index == 2) { printf("Button 3 pressed!\n\r"); } } } //Cmd from a reported object (happens when an object read is requested) if(Event.reportObject.cmd == GENIE_REPORT_OBJ) { } } int main() { 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"); while(1) { myled = 1; wait(0.2); myled = 0; wait(0.2); } }