Skip to content

Commit ec3d0aa

Browse files
committed
Added/clarified comments and configuration steps, swapped option order for WPA and OPEN security types.
Also successfully tested WEP connection types with the latest fixes applied to the WiFi101 library.
1 parent 7f3170f commit ec3d0aa

File tree

2 files changed

+50
-23
lines changed

2 files changed

+50
-23
lines changed

examples/StandardFirmataWiFi/StandardFirmataWiFi.ino

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
1212
Copyright (C) 2010-2011 Paul Stoffregen. All rights reserved.
1313
Copyright (C) 2009 Shigeru Kobayashi. All rights reserved.
14-
Copyright (C) 2009-2015 Jeff Hoefs. All rights reserved.
15-
Copyright (C) 2015 Jesse Frush. All rights reserved.
14+
Copyright (C) 2009-2016 Jeff Hoefs. All rights reserved.
15+
Copyright (C) 2015-2016 Jesse Frush. All rights reserved.
1616
1717
This library is free software; you can redistribute it and/or
1818
modify it under the terms of the GNU Lesser General Public
@@ -21,7 +21,7 @@
2121
2222
See file LICENSE.txt for further informations on licensing terms.
2323
24-
Last updated by Jesse Frush: January 4th, 2016
24+
Last updated by Jesse Frush: January 7th, 2016
2525
*/
2626

2727
/*
@@ -66,7 +66,12 @@
6666
#include <Wire.h>
6767
#include <Firmata.h>
6868

69-
#define SERIAL_DEBUG
69+
/*
70+
* Uncomment the #define SERIAL_DEBUG line below to receive serial output messages relating to your connection
71+
* that may help in the event of connection issues. If defined, some boards may not begin executing this sketch
72+
* until the Serial console is opened.
73+
*/
74+
//#define SERIAL_DEBUG
7075
#include "utility/firmataDebug.h"
7176

7277
// follow the instructions in wifiConfig.h to configure your particular hardware

examples/StandardFirmataWiFi/wifiConfig.h

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010

1111
/*
1212
* OPTION A: Configure for Arduino WiFi shield
13+
*
14+
* This will configure StandardFirmataWiFi to use the original WiFi library (deprecated) provided
15+
* with the Arduino IDE. It is supported by the Arduino WiFi shield (a discontinued product) and
16+
* is compatible with 802.11 B/G networks.
1317
*
14-
* To configure StandardFirmataWiFi to use the Arduino WiFi shield based on the HDG204 Wireless LAN 802.11b/g
18+
* To configure StandardFirmataWiFi to use the Arduino WiFi shield
1519
* leave the #define below uncommented.
1620
*/
1721
#define ARDUINO_WIFI_SHIELD
@@ -24,10 +28,13 @@ WiFiStream stream;
2428

2529
/*
2630
* OPTION B: Configure for WiFi 101
31+
*
32+
* This will configure StandardFirmataWiFi to use the WiFi101 library, which works with the Arduino WiFi101
33+
* shield and devices that have the WiFi101 chip built in (such as the MKR1000). It is compatible
34+
* with 802.11 B/G/N networks.
2735
*
28-
* To configure StandardFirmataWiFi to use the WiFi 101 library, either for the WiFi 101 shield or
29-
* any boards that include the WiFi 101 chip (such as the MKR1000), comment out the '#define ARDUINO_WIFI_SHIELD'
30-
* under OPTION A above, and uncomment the #define WIFI_101 below.
36+
* To enable, uncomment the #define WIFI_101 below and verify the #define values under
37+
* options A and C are commented out.
3138
*
3239
* IMPORTANT: You must have the WiFI 101 library installed. To easily install this library, opent the library manager via:
3340
* Arduino IDE Menus: Sketch > Include Library > Manage Libraries > filter search for "WiFi101" > Select the result and click 'install'
@@ -42,10 +49,12 @@ WiFi101Stream stream;
4249

4350
/*
4451
* OPTION C: Configure for HUZZAH
52+
*
53+
* HUZZAH is not yet supported, this will be added in a later revision to StandardFirmataWiFi
4554
*/
4655

4756
//------------------------------
48-
//TODO
57+
// TODO
4958
//------------------------------
5059
//#define HUZZAH_WIFI
5160

@@ -64,38 +73,51 @@ char ssid[] = "your_network_name";
6473
#define SERVER_PORT 3030
6574

6675
// STEP 5 [REQUIRED for all boards and shields]
67-
// determine your network security type (OPTION A, B, or C)
76+
// determine your network security type (OPTION A, B, or C). Option A is the most common, and the default.
77+
6878

6979
/*
70-
* OPTION A: Open network (no security)
71-
*
72-
* To connect to an open network, leave WIFI_NO_SECURITY uncommented and
73-
* do not uncomment the #define values under options B or C
80+
* OPTION A: WPA / WPA2
81+
*
82+
* WPA is the most common network security type. A passphrase is required to connect to this type.
83+
*
84+
* To enable, leave #define WIFI_WPA_SECURITY uncommented below, set your wpa_passphrase value appropriately,
85+
* and do not uncomment the #define values under options B and C
7486
*/
75-
//#define WIFI_NO_SECURITY
87+
#define WIFI_WPA_SECURITY
88+
89+
#ifdef WIFI_WPA_SECURITY
90+
char wpa_passphrase[] = "your_wpa_passphrase";
91+
#endif //WIFI_WPA_SECURITY
7692

7793
/*
7894
* OPTION B: WEP
7995
*
80-
* Uncomment the #define below and set your wep_index and wep_key values appropriately
96+
* WEP is a less common (and regarded as less safe) security type. A WEP key and its associated index are required
97+
* to connect to this type.
98+
*
99+
* To enable, Uncomment the #define below, set your wep_index and wep_key values appropriately, and verify
100+
* the #define values under options A and C are commented out.
81101
*/
82102
//#define WIFI_WEP_SECURITY
83103

84104
#ifdef WIFI_WEP_SECURITY
105+
//The wep_index below is a zero-indexed value.
106+
//Valid indices are [0-3], even if your router/gateway numbers your keys [1-4].
85107
byte wep_index = 0;
86108
char wep_key[] = "your_wep_key";
87109
#endif //WIFI_WEP_SECURITY
88110

111+
89112
/*
90-
* OPTION C: WPA / WPA2
113+
* OPTION C: Open network (no security)
114+
*
115+
* Open networks have no security, can be connected to by any device that knows the ssid, and are unsafe.
91116
*
92-
* Uncomment the #define below and set your passphrase appropriately
117+
* To enable, uncomment #define WIFI_NO_SECURITY below and verify the #define values
118+
* under options A and B are commented out.
93119
*/
94-
#define WIFI_WPA_SECURITY
95-
96-
#ifdef WIFI_WPA_SECURITY
97-
char wpa_passphrase[] = "your_wpa_passphrase";
98-
#endif //WIFI_WPA_SECURITY
120+
//#define WIFI_NO_SECURITY
99121

100122
/*==============================================================================
101123
* CONFIGURATION ERROR CHECK (don't change anything here)

0 commit comments

Comments
 (0)