Created
November 12, 2012 21:23
-
-
Save zer0her0/4061989 to your computer and use it in GitHub Desktop.
Arduino Wifi shield code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <WiFi.h> | |
| char ssid[] = "yourNetwork"; // your network SSID (name) | |
| char pass[] = "12345678"; // your network password | |
| int status = WL_IDLE_STATUS; // the Wifi radio's status | |
| void setup() { | |
| // initialize serial: | |
| Serial.begin(9600); | |
| // attempt to connect using WPA2 encryption: | |
| Serial.println("Attempting to connect to WPA network..."); | |
| status = WiFi.begin(ssid, pass); | |
| // if you're not connected, stop here: | |
| if ( status != WL_CONNECTED) { | |
| Serial.println("Couldn't get a wifi connection"); | |
| while(true); | |
| } | |
| // if you are connected, print out info about the connection: | |
| else { | |
| Serial.println("Connected to network"); | |
| } | |
| } | |
| void loop() { | |
| // do nothing | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment