Development

Communication / WiFi:

» Wifi 03: Display module status

This example shows how to get the status of the different WIFI module features.

Required Materials

1 x Waspmote
1 x Battery
1 x Wifi Module

Notes

- The battery has to be connected.
- Plug the antenna in the SMA connector.
- REMEMBER TO UNCOMMENT THE DEFINITON OF DEBUG_MODE IN WaspWIFI.h

Code

/*
 *  ------Waspmote WIFI_03 Example--------
 *
 *  Explanation: This example shows how to get the status of the different
 *  WIFI module features.
 *  Remarks: DEBUG mode must be enabled before compiling this example. Please
 *  check the WaspWIFI.h file and uncomment the "#define DEBUG_WIFI" definition
 *  
 *  Copyright (C) 2013 Libelium Comunicaciones Distribuidas S.L.
 *  http://www.libelium.com
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  Version:                0.2
 *  Design:                 David Gascón
 *  Implementation:         Joaquin Ruiz
 */
 
// Include WIFI library 
#include <WaspWIFI.h>

/****************************************
REMEMBER TO UNCOMMENT THE DEFINITON 
OF DEBUG_MODE IN WaspWIFI.h
*****************************************/

// choose socket (SELECT USER'S SOCKET)
///////////////////////////////////////
uint8_t socket=SOCKET0;
///////////////////////////////////////

void setup()
{
  // Switch ON the WiFi module on the desired socket
  if( WIFI.ON(SOCKET0) == 1 )
  {    
    USB.println(F("Wifi switched ON"));
  }
  else
  {
    USB.println(F("Wifi did not initialize correctly"));
  }

}

void loop()
{
  // Displays Firmware version
  USB.println(F("\n----------------------"));
  USB.println(F("Firmware Version:"));
  USB.println(F("----------------------"));
  WIFI.getVersion();
  
  // Displays connection status.  
  USB.println(F("\n----------------------"));
  USB.println(F("Connection Info:"));
  USB.println(F("----------------------"));
  WIFI.getConnectionInfo();
  
  // Displays Access Point status.
  USB.println(F("\n----------------------"));
  USB.println(F("AP Status:"));
  USB.println(F("----------------------"));
  WIFI.getAPstatus();
  
  // Displays singal strenght information.
  USB.println(F("\n----------------------"));
  USB.println(F("RSSI:"));
  USB.println(F("----------------------"));
  WIFI.getRSSI();
  
  // Displays the statistics of the sent and received packets.
  USB.println(F("\n----------------------"));
  USB.println(F("Statistics:"));
  USB.println(F("----------------------"));
  WIFI.getStats();
  
  // Diplays the seconds since last powerup or reboot.
  USB.println(F("\n----------------------"));
  USB.println(F("Up Time:"));
  USB.println(F("----------------------"));
  WIFI.getUpTime();
  
  // Diplays adhoc settings.
  USB.println(F("\n----------------------"));
  USB.println(F("Adhoc Settings:"));
  USB.println(F("----------------------"));
  WIFI.getAdhocSettings();
  
  // Displays broadcast settings.
  USB.println(F("\n----------------------"));
  USB.println(F("Broadcast Settings:"));
  USB.println(F("----------------------"));
  WIFI.getBroadcastSettings();
  
  // Displays communications settings.
  USB.println(F("\n----------------------"));
  USB.println(F("Communication Settings:"));
  USB.println(F("----------------------"));
  WIFI.getComSettings();
  
  // Displays DNS settings.
  USB.println(F("\n----------------------"));
  USB.println(F("DNS Settings:"));
  USB.println(F("----------------------"));
  WIFI.getDNSsettings();
  
  // Displays FTP settings.
  USB.println(F("\n----------------------"));
  USB.println(F("FTP Settings:"));
  USB.println(F("----------------------"));
  WIFI.getFTPsettings();
  
  // Displays IP settings.
  USB.println(F("\n----------------------"));
  USB.println(F("IP Settings:"));
  USB.println(F("----------------------"));
  WIFI.getIP();
  
  // Displays the MAC address.
  USB.println(F("\n----------------------"));
  USB.println(F("MAC Settings:"));
  USB.println(F("----------------------"));
  WIFI.getMAC();
  
  // Displays option settings.
  USB.println(F("\n----------------------"));
  USB.println(F("Option Settings:"));
  USB.println(F("----------------------"));
  WIFI.getOptionSettings();
  
  // Displays system settings.
  USB.println(F("\n----------------------"));
  USB.println(F("System Settings:"));
  USB.println(F("----------------------"));
  WIFI.getSystemSettings();


  USB.println(F("\n*******************************************"));
  delay(10000);
}

Output

D#
*OFF
enter CMD at 115200
Wifi switched ON

----------------------
Firmware Version:
----------------------
Ver 2.32, 02-13-2012 on RN-171
<2.32>

----------------------
Connection Info:
----------------------
Chann: 6
TCP status = NOIP

----------------------
AP Status:
----------------------
SSid=roving1
Chan=6
Assoc=FAIL
Rate=12, 24Mb
Auth=FAIL
Mode=NONE
DHCP=FAIL
Boot=0
Time=OK
Links=0
<2.32>

----------------------
RSSI:
----------------------
RSSI=(-5) dBm
<2.32>

----------------------
Statistics:
----------------------
Conns=0, WRX=0/0, WTX=0/0, RTRY=0, RTRYfail=0
URX=0, UTX=245, RXdrop=0, RXerr=386,
FlwSet=0, FlwClr=0
TX-UDP=0, netbufs=0, evt=0, adhoc_lost=0
Boots=1, Wdogs=0,TXon=0
<2.32>
WRX:0
WTX:0
flwSet:0

----------------------
Up Time:
----------------------
Time NOT SET
UpTime=7 s
<2.32>

----------------------
Adhoc Settings:
----------------------
Beacon=100
Probe=5
Reboot=0
<2.32>

----------------------
Broadcast Settings:
----------------------
BCAST=255.255.255.255:55555
Interval=0x7
<2.32>

----------------------
Communication Settings:
----------------------
OPEN=*OPEN*
CLOSE=*CLOS*
REMOTE=*HELLO*
FlushSize=900
MatchChar=0
FlushTimer=10
IdleTimer=0
CmdChar=$
<2.32>

----------------------
DNS Settings:
----------------------
DNS=0.0.0.0
Name=server1
Backup=backup2
<2.32>

----------------------
FTP Settings:
----------------------
FTP=208.109.78.34:21
File=wifly-EZX.img
User=roving
Pass=Pass123
Dir=public
Timeout=80
FTP_mode=0x0
<2.32>

----------------------
IP Settings:
----------------------
IF=DOWN
DHCP=ON
IP=0.0.0.0:2000
NM=255.255.255.0
GW=0.0.0.0
HOST=0.0.0.0:2000
PROTO=TCP,
MTU=1524
FLAGS=0x7
TCPMODE=0x0
BACKUP=0.0.0.0
<2.32>

----------------------
MAC Settings:
----------------------
Mac Addr=00:06:66:80:c2:b7
<2.32>

----------------------
Option Settings:
----------------------
JoinTmr=1000
Replace=0x24
DeviceId=WiFly-EZX
Password=
Format=0x0
Signal=0
Average=5
<2.32>

----------------------
System Settings:
----------------------

SleepTmr=0
WakeTmr=0
Trigger=0x1
Autoconn=0
IoFunc=0x0
IoMask=0x21f0
IoValu=0x0
DebugReg=0x0
PrintLvl=0x4000
<2.32>

*******************************************

Quick Publish: