Skip to content

Commit

Permalink
Initial changes to support u-blox NINA-W102 with Arduino firmware
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepmistry committed Jun 28, 2018
1 parent 755bf82 commit 9676cfe
Show file tree
Hide file tree
Showing 44 changed files with 1,392 additions and 309 deletions.
9 changes: 6 additions & 3 deletions README.adoc
@@ -1,12 +1,15 @@
= WiFi Library for Arduino =
= WiFi1010 Library for Arduino =

With the Arduino WiFi Shield, this library allows an Arduino board to connect to the internet.
Enables network connection (local and Internet) with the Arduino MKR WiFi 1010, Arduino MKR VIDOR 4000 and Arduino UNO WiFi Rev.2.

With this library you can instantiate Servers, Clients and send/receive UDP packets through WiFi. The board can connect either to open or encrypted networks (WEP, WPA). The IP address can be assigned statically or through a DHCP. The library can also manage DNS.

For more information about this library please visit us at
http://www.arduino.cc/en/Reference/WiFi
http://www.arduino.cc/en/Reference/WiFi1010

== License ==

Copyright (C) 2018 Arduino AG (http://www.arduino.cc/)
Copyright (c) 2011-2014 Arduino LLC. All right reserved.
Copyright (C) 2006-2008, Atmel Corporation All rights reserved.
Copyright (c) 2001-2004 Swedish Institute of Computer Science.
Expand Down
20 changes: 9 additions & 11 deletions examples/ConnectNoEncryption/ConnectNoEncryption.ino
Expand Up @@ -4,18 +4,17 @@
Then it prints the MAC address of the Wifi shield,
the IP address obtained, and other network details.
Circuit:
* WiFi shield attached
created 13 July 2010
by dlf (Metodo2 srl)
modified 31 May 2012
by Tom Igoe
*/
#include <SPI.h>
#include <WiFi.h>
#include <WiFi1010.h>

char ssid[] = "yourNetwork"; // the name of your network
#include "arduino_secrets.h"
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
int status = WL_IDLE_STATUS; // the Wifi radio's status

void setup() {
Expand All @@ -24,16 +23,15 @@ void setup() {
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}

// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}

String fv = WiFi.firmwareVersion();
if (fv != "1.1.0") {
if (fv != "1.0.0") {
Serial.println("Please upgrade the firmware");
}

Expand Down
1 change: 1 addition & 0 deletions examples/ConnectNoEncryption/arduino_secrets.h
@@ -0,0 +1 @@
#define SECRET_SSID ""
25 changes: 12 additions & 13 deletions examples/ConnectWithWEP/ConnectWithWEP.ino
@@ -1,7 +1,7 @@
/*
This example connects to a WEP-encrypted Wifi network.
Then it prints the MAC address of the Wifi shield,
Then it prints the MAC address of the Wifi module,
the IP address obtained, and other network details.
If you use 40-bit WEP, you need a key that is 10 characters long,
Expand All @@ -14,19 +14,18 @@
D0D0DEADF00DABBADEAFBEADED will work because it's 26 characters,
all in the 0-9, A-F range.
Circuit:
* WiFi shield attached
created 13 July 2010
by dlf (Metodo2 srl)
modified 31 May 2012
by Tom Igoe
*/
#include <SPI.h>
#include <WiFi.h>
#include <WiFi1010.h>

char ssid[] = "yourNetwork"; // your network SSID (name)
char key[] = "D0D0DEADF00DABBADEAFBEADED"; // your network key
#include "arduino_secrets.h"
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0; // your network key Index number
int status = WL_IDLE_STATUS; // the Wifi radio's status

Expand All @@ -37,23 +36,23 @@ void setup() {
; // wait for serial port to connect. Needed for native USB port only
}

// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}

String fv = WiFi.firmwareVersion();
if (fv != "1.1.0") {
if (fv != "1.0.0") {
Serial.println("Please upgrade the firmware");
}

// attempt to connect to Wifi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to WEP network, SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, keyIndex, key);
status = WiFi.begin(ssid, keyIndex, pass);

// wait 10 seconds for connection:
delay(10000);
Expand Down
2 changes: 2 additions & 0 deletions examples/ConnectWithWEP/arduino_secrets.h
@@ -0,0 +1,2 @@
#define SECRET_SSID ""
#define SECRET_PASS ""
23 changes: 11 additions & 12 deletions examples/ConnectWithWPA/ConnectWithWPA.ino
@@ -1,22 +1,21 @@
/*
This example connects to an unencrypted Wifi network.
Then it prints the MAC address of the Wifi shield,
Then it prints the MAC address of the Wifi module,
the IP address obtained, and other network details.
Circuit:
* WiFi shield attached
created 13 July 2010
by dlf (Metodo2 srl)
modified 31 May 2012
by Tom Igoe
*/
#include <SPI.h>
#include <WiFi.h>
#include <WiFi1010.h>

char ssid[] = "yourNetwork"; // your network SSID (name)
char pass[] = "secretPassword"; // your network password
#include "arduino_secrets.h"
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS; // the Wifi radio's status

void setup() {
Expand All @@ -26,15 +25,15 @@ void setup() {
; // wait for serial port to connect. Needed for native USB port only
}

// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}

String fv = WiFi.firmwareVersion();
if (fv != "1.1.0") {
if (fv != "1.0.0") {
Serial.println("Please upgrade the firmware");
}

Expand Down
2 changes: 2 additions & 0 deletions examples/ConnectWithWPA/arduino_secrets.h
@@ -0,0 +1,2 @@
#define SECRET_SSID ""
#define SECRET_PASS ""
14 changes: 7 additions & 7 deletions examples/ScanNetworks/ScanNetworks.ino
@@ -1,7 +1,7 @@
/*
This example prints the Wifi shield's MAC address, and
scans for available Wifi networks using the Wifi shield.
scans for available Wifi networks using the Wifi module.
Every ten seconds, it scans again. It doesn't actually
connect to any network, so no encryption scheme is specified.
Expand All @@ -16,7 +16,7 @@


#include <SPI.h>
#include <WiFi.h>
#include <WiFi1010.h>

void setup() {
//Initialize serial and wait for port to open:
Expand All @@ -25,15 +25,15 @@ void setup() {
; // wait for serial port to connect. Needed for native USB port only
}

// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}

String fv = WiFi.firmwareVersion();
if (fv != "1.1.0") {
if (fv != "1.0.0") {
Serial.println("Please upgrade the firmware");
}

Expand Down
23 changes: 13 additions & 10 deletions examples/SimpleWebServerWiFi/SimpleWebServerWiFi.ino
Expand Up @@ -2,11 +2,11 @@
WiFi Web Server LED Blink
A simple web server that lets you blink an LED via the web.
This sketch will print the IP address of your WiFi Shield (once connected)
This sketch will print the IP address of your WiFi module (once connected)
to the Serial monitor. From there, you can open that address in a web browser
to turn on and off the LED on pin 9.
If the IP address of your shield is yourAddress:
If the IP address of your board is yourAddress:
http://yourAddress/H turns the LED on
http://yourAddress/L turns it off
Expand All @@ -21,10 +21,12 @@
by Tom Igoe
*/
#include <SPI.h>
#include <WiFi.h>
#include <WiFi1010.h>

char ssid[] = "yourNetwork"; // your network SSID (name)
char pass[] = "secretPassword"; // your network password
#include "arduino_secrets.h"
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0; // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;
Expand All @@ -34,14 +36,15 @@ void setup() {
Serial.begin(9600); // initialize serial communication
pinMode(9, OUTPUT); // set the LED pin mode

// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
while (true); // don't continue
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}

String fv = WiFi.firmwareVersion();
if (fv != "1.1.0") {
if (fv != "1.0.0") {
Serial.println("Please upgrade the firmware");
}

Expand Down
2 changes: 2 additions & 0 deletions examples/SimpleWebServerWiFi/arduino_secrets.h
@@ -0,0 +1,2 @@
#define SECRET_SSID ""
#define SECRET_PASS ""
18 changes: 10 additions & 8 deletions examples/WiFiChatServer/WiFiChatServer.ino
Expand Up @@ -20,10 +20,12 @@
*/

#include <SPI.h>
#include <WiFi.h>
#include <WiFi1010.h>

char ssid[] = "yourNetwork"; // your network SSID (name)
char pass[] = "secretPassword"; // your network password (use for WPA, or use as key for WEP)
#include "arduino_secrets.h"
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)

int keyIndex = 0; // your network key Index number (needed only for WEP)

Expand All @@ -40,15 +42,15 @@ void setup() {
; // wait for serial port to connect. Needed for native USB port only
}

// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}

String fv = WiFi.firmwareVersion();
if (fv != "1.1.0") {
if (fv != "1.0.0") {
Serial.println("Please upgrade the firmware");
}

Expand Down
2 changes: 2 additions & 0 deletions examples/WiFiChatServer/arduino_secrets.h
@@ -0,0 +1,2 @@
#define SECRET_SSID ""
#define SECRET_PASS ""
18 changes: 10 additions & 8 deletions examples/WiFiUdpNtpClient/WiFiUdpNtpClient.ino
Expand Up @@ -17,12 +17,14 @@
*/

#include <SPI.h>
#include <WiFi.h>
#include <WiFi1010.h>
#include <WiFiUdp.h>

int status = WL_IDLE_STATUS;
char ssid[] = "mynetwork"; // your network SSID (name)
char pass[] = "mypassword"; // your network password
#include "arduino_secrets.h"
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0; // your network key Index number (needed only for WEP)

unsigned int localPort = 2390; // local port to listen for UDP packets
Expand All @@ -43,15 +45,15 @@ void setup() {
; // wait for serial port to connect. Needed for native USB port only
}

// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}

String fv = WiFi.firmwareVersion();
if (fv != "1.1.0") {
if (fv != "1.0.0") {
Serial.println("Please upgrade the firmware");
}

Expand Down
2 changes: 2 additions & 0 deletions examples/WiFiUdpNtpClient/arduino_secrets.h
@@ -0,0 +1,2 @@
#define SECRET_SSID ""
#define SECRET_PASS ""

0 comments on commit 9676cfe

Please sign in to comment.