Seeed wifi shield hello world program

Dependencies:   WiflyInterface mbed

Fork of Wifly_HelloWorld by Samuel Mokrani

Committer:
lz307
Date:
Fri Nov 08 22:55:36 2013 +0000
Revision:
7:6a7917d88dbe
Parent:
6:73c142780ad9
deleted necessary files;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
samux 0:90ba0f51aa64 1 #include "mbed.h"
samux 3:3b84102f022e 2 #include "WiflyInterface.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 3:3b84102f022e 8 * - p25 is for the reset pin
samux 3:3b84102f022e 9 * - p26 is for the connection status
lz307 6:73c142780ad9 10 * - "hotspot_name" is the ssid of the network
samux 1:49e1e9ed6e39 11 * - "password" is the password
lz307 6:73c142780ad9 12 * - WPA is the security method
samux 1:49e1e9ed6e39 13 */
lz307 6:73c142780ad9 14 WiflyInterface eth(p9, p10, p25, p26, "hotspot_name", "password", WPA);
lz307 6:73c142780ad9 15
lz307 6:73c142780ad9 16 int main()
lz307 6:73c142780ad9 17 {
lz307 6:73c142780ad9 18 int s = eth.init(); //Use DHCP
samux 0:90ba0f51aa64 19
lz307 6:73c142780ad9 20 if( s != NULL ) {
lz307 6:73c142780ad9 21 printf( "Could not initialise. Will halt!\n" );
lz307 6:73c142780ad9 22 exit( 0 );
lz307 6:73c142780ad9 23 }
lz307 6:73c142780ad9 24
lz307 6:73c142780ad9 25 s = eth.connect(); // set up the chip and join the network
lz307 6:73c142780ad9 26
lz307 6:73c142780ad9 27 if( s == false ) {
lz307 6:73c142780ad9 28 printf( "Could not connect. Will halt!\n" );
lz307 6:73c142780ad9 29 exit( 0 );
lz307 6:73c142780ad9 30 } else {
lz307 6:73c142780ad9 31 // print the IP address of the shield
lz307 6:73c142780ad9 32 printf( "IP: %s\n", eth.getIPAddress() );
lz307 6:73c142780ad9 33 }
lz307 6:73c142780ad9 34 }