Created
October 16, 2012 09:03
-
-
Save biskandar/3898186 to your computer and use it in GitHub Desktop.
Reading Arduino's Analog Pins with JSON Protocol by using WiFi Shield 2012101607
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 <aJSON.h> | |
#include <SPI.h> | |
#include <WiFi.h> | |
// build web server with listener port 80 | |
WiFiServer server( 80 ) ; | |
void setup() { | |
// validate if the wifi shield plugged | |
if ( WiFi.status() == WL_NO_SHIELD ) { | |
Serial.println( "Wifi shield is not plugged yet" ) ; | |
while( true ) ; | |
} | |
// attempt to connect to an open network | |
Serial.println( "Attempting to connect to open network..." ) ; | |
status = WiFi.begin( ssid , pass ) ; | |
// if found not connected , stop here | |
if ( status != WL_CONNECTED ) { | |
Serial.println( "Couldn't get a wifi connection" ) ; | |
while ( true ) ; | |
} | |
// server start | |
server.begin() ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment