Skip to content

Instantly share code, notes, and snippets.

@biskandar
Created October 16, 2012 09:03
Show Gist options
  • Save biskandar/3898186 to your computer and use it in GitHub Desktop.
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
#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