GSwifiInterface (interface for GainSpan Wi-Fi GS1011 modules) see https://mbed.org/users/gsfan/notebook/GSwifiInterface/

Dependencies:   GSwifiInterface mbed

Fork of Wifly_HelloWorld by Samuel Mokrani

Committer:
samux
Date:
Mon Jan 30 10:54:57 2012 +0000
Revision:
2:31905fe9369f
Parent:
1:49e1e9ed6e39
Child:
3:3b84102f022e

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
samux 0:90ba0f51aa64 1 #include "mbed.h"
samux 1:49e1e9ed6e39 2 #include "Wifly.h"
samux 1:49e1e9ed6e39 3
samux 1:49e1e9ed6e39 4 Serial pc(USBTX, USBRX);
samux 1:49e1e9ed6e39 5
samux 1:49e1e9ed6e39 6 /* wifly object where:
samux 1:49e1e9ed6e39 7 * - p9 and p10 are for the serial communication
samux 1:49e1e9ed6e39 8 * - p17 is for the reset pin
samux 1:49e1e9ed6e39 9 * - "mbed" is the ssid of the network
samux 1:49e1e9ed6e39 10 * - "password" is the password
samux 1:49e1e9ed6e39 11 * - true means that the security of the network is WPA
samux 1:49e1e9ed6e39 12 */
samux 2:31905fe9369f 13 Wifly wifly(p9, p10, p21, "mbed", "password", true);
samux 1:49e1e9ed6e39 14
samux 0:90ba0f51aa64 15
samux 1:49e1e9ed6e39 16 int main() {
samux 1:49e1e9ed6e39 17 char recv[129];
samux 1:49e1e9ed6e39 18
samux 1:49e1e9ed6e39 19 // join the network specified in the constructor
samux 1:49e1e9ed6e39 20 while (!wifly.join()) {
samux 1:49e1e9ed6e39 21 printf("cannot to join the network, will retry!\r\n");
samux 1:49e1e9ed6e39 22 wifly.reset();
samux 1:49e1e9ed6e39 23 }
samux 1:49e1e9ed6e39 24
samux 1:49e1e9ed6e39 25 printf("network joined!\r\n");
samux 1:49e1e9ed6e39 26
samux 1:49e1e9ed6e39 27 //print all received messages
samux 1:49e1e9ed6e39 28 while(1)
samux 1:49e1e9ed6e39 29 {
samux 1:49e1e9ed6e39 30 if(wifly.readable()) {
samux 1:49e1e9ed6e39 31 wifly.read(recv);
samux 1:49e1e9ed6e39 32 printf("read: %s\r\n", recv);
samux 1:49e1e9ed6e39 33 }
samux 1:49e1e9ed6e39 34 wait(0.2);
samux 1:49e1e9ed6e39 35 }
samux 1:49e1e9ed6e39 36 }