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
| aJsonObject *jsonAnalogs() { | |
| aJsonObject *jsonRoot = aJson.createObject() ; | |
| aJson.addNumberToObject( jsonRoot , "millis" , (int) millis() ) ; | |
| aJsonObject *jsonAnalogs = aJson.createIntArray( arrAnalogs , maxAnalogs ) ; | |
| aJson.addItemToObject( jsonRoot , "analogs" , jsonAnalogs ) ; | |
| return jsonRoot ; | |
| } |
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> | |
| void loop() { | |
| if ( ( ctrSeconds % secDebug ) == 0 ) { | |
| // infoAnalogs() ; | |
| Serial.println( aJson.print( jsonAnalogs() ) ) ; | |
| } | |
| } |
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
| void processHttpClient() { | |
| // verify if there is new client connected | |
| WiFiClient client = server.available() ; | |
| if ( !client ) return ; | |
| Serial.println( "Client connected" ) ; | |
| // prepare for reading request data | |
| boolean isBlankLine = true ; | |
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 ) { |
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 <SPI.h> | |
| #include <WiFi.h> | |
| char ssid[] = "biskandar" ; | |
| char pass[] = "*******" ; | |
| int status = WL_IDLE_STATUS ; | |
| // build web server with listener port 80 | |
| WiFiServer server( 80 ) ; |
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
| void setup() { | |
| // initialize serial | |
| Serial.begin( 9600 ) ; | |
| while( !Serial ) ; // it only start the code when found serial pc terminal connected | |
| // validate if the wifi shield plugged | |
| if ( WiFi.status() == WL_NO_SHIELD ) { | |
| Serial.println( "Wifi shield is not plugged yet" ) ; | |
| while( true ) ; |
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
| void loop() { | |
| // verify if there is new client connected | |
| WiFiClient client = server.available() ; | |
| if ( !client ) return ; | |
| // prepare for reading request data | |
| boolean isBlankLine = true ; | |
| // found new client connected and process the request data |
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 <SPI.h> | |
| #include <Ethernet.h> | |
| #include <LiquidCrystal.h> | |
| // prepare for lcd shield | |
| LiquidCrystal lcd( 8 , 9 , 4 , 5 , 6 , 7 ) ; | |
| // prepare for ethernet shield | |
| byte mac[] = { 0x00 , 0x08 , 0xDC , 0x00 , 0x00 , 0x09 } ; |
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
| void loop() { | |
| // verify if there is new client connected | |
| EthernetClient client = server.available() ; | |
| if ( !client ) return ; | |
| // prepare for reading request data | |
| boolean isBlankLine = true ; | |
| // read and proces the client request data |
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 "arduPi.h" | |
| int main () { | |
| setup() ; | |
| while(1) { | |
| loop() ; | |
| } | |
| return 0; | |
| } |