Hello World with a wifly module (RN 131 C/G - RN-XV)
Dependencies: mbed WiflyInterface
Revision 3:3b84102f022e, committed 2012-08-17
- Comitter:
- samux
- Date:
- Fri Aug 17 10:57:22 2012 +0000
- Parent:
- 2:31905fe9369f
- Child:
- 4:fd030db1a6f4
- Commit message:
- first commit with new wifly interface
Changed in this revision
--- a/Wifly.lib Mon Jan 30 10:54:57 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/samux/code/Wifly/#56f3c4da1ea8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WiflyInterface.lib Fri Aug 17 10:57:22 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/samux/code/WiflyInterface/#6ffb0aeb3972
--- a/main.cpp Mon Jan 30 10:54:57 2012 +0000 +++ b/main.cpp Fri Aug 17 10:57:22 2012 +0000 @@ -1,36 +1,20 @@ #include "mbed.h" -#include "Wifly.h" +#include "WiflyInterface.h" Serial pc(USBTX, USBRX); /* wifly object where: * - p9 and p10 are for the serial communication -* - p17 is for the reset pin +* - p25 is for the reset pin +* - p26 is for the connection status * - "mbed" is the ssid of the network * - "password" is the password * - true means that the security of the network is WPA */ -Wifly wifly(p9, p10, p21, "mbed", "password", true); - +WiflyInterface wifly(p9, p10, p25, p26, "ARMASE06", "armasedemo", true); int main() { - char recv[129]; - - // join the network specified in the constructor - while (!wifly.join()) { - printf("cannot to join the network, will retry!\r\n"); - wifly.reset(); - } - - printf("network joined!\r\n"); - - //print all received messages - while(1) - { - if(wifly.readable()) { - wifly.read(recv); - printf("read: %s\r\n", recv); - } - wait(0.2); - } + wifly.init(); // use DHCP + while (!wifly.connect()); // join the network + printf("IP Address is %s\n\r", wifly.getIPAddress()); } \ No newline at end of file
--- a/mbed.bld Mon Jan 30 10:54:57 2012 +0000 +++ b/mbed.bld Fri Aug 17 10:57:22 2012 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912 +http://mbed.org/users/mbed_official/code/mbed/builds/10b9abbe79a6 \ No newline at end of file