Hello World with a wifly module (RN 131 C/G - RN-XV)

Dependencies:   mbed WiflyInterface

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "WiflyInterface.h"
00003 
00004 Serial pc(USBTX, USBRX);
00005 
00006 /* wifly object where:
00007 *     - p9 and p10 are for the serial communication
00008 *     - p25 is for the reset pin
00009 *     - p26 is for the connection status
00010 *     - "mbed" is the ssid of the network
00011 *     - "password" is the password
00012 *     - WPA is the security
00013 */
00014 WiflyInterface wifly(p9, p10, p25, p26, "mbed", "password", WPA);
00015 
00016 int main() {
00017     wifly.init(); // use DHCP
00018     while (!wifly.connect()); // join the network
00019     printf("IP Address is %s\n\r", wifly.getIPAddress());
00020     wifly.disconnect();
00021 }