Skip to content

Instantly share code, notes, and snippets.

@biskandar
Created October 17, 2012 06:47
Show Gist options
  • Save biskandar/3904071 to your computer and use it in GitHub Desktop.
Save biskandar/3904071 to your computer and use it in GitHub Desktop.
Request Counter with Arduino Uno + Ethernet Shield + LCD Shield 2012101701
#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 } ;
// prepare for web server
EthernetServer server = EthernetServer( 80 ) ;
// prepare for request counter
int totalRequestor = 0 ;
void setup() {
// for debug purpose
Serial.begin( 9600 ) ;
// initializing lcd
lcd.begin( 16 , 2 ) ;
// initializing connection
if ( !Ethernet.begin( mac ) ) {
while ( true ) ;
}
// run the server
server.begin() ;
lcdPrint( 0 , 0 , "Server: Ready." ) ;
}
// print text on the lcd shield start with
// col and row cursor position
void lcdPrint( int col , int row , String str ) {
lcd.setCursor( col , row ) ;
lcd.print( str ) ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment