Arduino Uno CC3000 Wifi Shield Documentation
The Arduino Uno CC3000 Wifi Shield is a popular Wi-Fi shield designed to work with the Arduino Uno board. It provides a simple and cost-effective way to add Wi-Fi connectivity to your Arduino projects. The shield is based on the CC3000 Wi-Fi module from Texas Instruments, which is a low-power, low-cost Wi-Fi solution.
The Arduino Uno CC3000 Wifi Shield consists of the following components:
CC3000 Wi-Fi module
Antenna
Reset button
LED indicators for Wi-Fi status and activity
SPI bus interface for communication with the Arduino board
To use the Arduino Uno CC3000 Wifi Shield, you need to install the CC3000 library for Arduino. You can download the library from the Arduino website or install it through the Arduino Library Manager.
### Example 1: Connecting to a Wi-Fi Network
In this example, we will connect the Arduino Uno board to a Wi-Fi network using the CC3000 Wifi Shield.
#define WLAN_SSID "your_wifi_ssid"
#define WLAN_PASS "your_wifi_password"
#define WLAN_SECURITY WLAN_SEC_WPA2
void setup() {
Serial.begin(9600);
/ Initialize CC3000 module /
CC3000.begin();
/ Connect to Wi-Fi network /
Serial.println("Connecting to Wi-Fi...");
if (!CC3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
Serial.println("Failed to connect to Wi-Fi");
while(1);
}
Serial.println("Connected to Wi-Fi!");
}
void loop() {
/ Do something after connecting to Wi-Fi /
Serial.println("Connected to Wi-Fi!");
delay(1000);
}
```
### Example 2: Sending an HTTP Request
In this example, we will send an HTTP request to a web server using the CC3000 Wifi Shield.
```c
#include <CC3000.h>
#include <CC3000Net.h>
#define WLAN_SSID "your_wifi_ssid"
#define WLAN_PASS "your_wifi_password"
#define WLAN_SECURITY WLAN_SEC_WPA2
#define SERVER_IP "google.com"
#define PORT 80
void setup() {
Serial.begin(9600);
/ Initialize CC3000 module /
CC3000.begin();
/ Connect to Wi-Fi network /
Serial.println("Connecting to Wi-Fi...");
if (!CC3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
Serial.println("Failed to connect to Wi-Fi");
while(1);
}
Serial.println("Connected to Wi-Fi!");
/ Initialize TCP client /
net = CC3000Net();
}
void loop() {
/ Send an HTTP request to the server /
Serial.println("Sending HTTP request...");
net.connect(SERVER_IP, PORT);
net.print("GET / HTTP/1.1
Host: ");
net.print(SERVER_IP);
net.println("
");
/ Read the response from the server /
while (net.connected()) {
if (net.available()) {
char c = net.read();
Serial.print(c);
}
}
/ Close the connection /
net.close();
delay(1000);
}
```
### Example 3: Scanner Application (List Available Wi-Fi Networks)
In this example, we will create a scanner application that lists the available Wi-Fi networks in range.
void setup() {
Serial.begin(9600);
/ Initialize CC3000 module /
CC3000.begin();
}
void loop() {
int i;
int numNetworks = CC3000.scanNetworks();
Serial.println("Available Wi-Fi networks:");
for (i = 0; i < numNetworks; i++) {
Serial.print(i + 1);
Serial.print(": ");
Serial.println(CC3000.SSID(i));
}
Make sure to install the CC3000 library for Arduino and import it in your sketch.
Ensure that you have the correct Wi-Fi credentials and network settings.
Check the CC3000 module's antenna connection and ensure it is properly connected to the shield.
The Arduino Uno CC3000 Wifi Shield is a powerful tool for adding Wi-Fi connectivity to your Arduino projects. With the provided code examples, you can start building your own Wi-Fi-enabled projects, such as IoT devices, robotics, and more.