Top Banner

of 6

Control+an+LED+over+the+Internet+using+the+Arduino+Ethernet+shield

Oct 12, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 5/21/2018 Control+an+LED+over+the+Internet+using+the+Arduino+Ethernet+shield

    1/6

    Control an LED over the Internet using the Arduino Ethernet Shield

    16 Apr. 2013

    How to control an LED over the Internet using an Arduino and an ethernet shield

    SOURCE: http://www.instructables.co/i!/Control"an"#E$"o%er"the"internet"usin&"the"Ar!uino/

    Original CODE: http://pastebin.com/C!"!#$"

    'AR(S :

    1) Ar!uino *+ a usin& the $ueilano%e,

    1) Ar!uino Ethernet shiel! *with a -100 chip,

    1) noral #E$

    %he circuit:

    LED anode &'( to Arduino Ethernet shield pin !) LED cathode &*( to +,D

    AA 1 16/0/13

    http://www.instructables.com/id/Control-an-LED-over-the-internet-using-the-Arduino/http://pastebin.com/CZ6J62qJhttp://pastebin.com/CZ6J62qJhttp://www.instructables.com/id/Control-an-LED-over-the-internet-using-the-Arduino/
  • 5/21/2018 Control+an+LED+over+the+Internet+using+the+Arduino+Ethernet+shield

    2/6

    %HE CODE &-ODIICA%IO, b0 AA1 2! A34IL #526 (

    // ILE,A-E 7 LED#.ino// O84CE7 http://www.instructables.com/id/Control9an9LED9over9the9internet9using9the9Arduino/// Control an LED over the internet using the Arduino Ethernet hield and %ransistor// http://www.instructables.com/id/Control9an9LED9over9the9internet9using9the9Arduino/// code O84CE7 http://pastebin.com/C!"!#$"

    include ;3I.h? 7 @ 2#1 2!1 21 2 ) // internet access via routerb0te subnet>? 7 @ #1 #1 #1 5 ) //subnet masEtherneterver server&5() //server port

    tring readtring)//////////////////////void setup&(@pin-ode&!1 O8%38%() //pin selected to control LED//start EthernetEthernet.begin&mac1 ip1 gatewa01 subnet()server.begin&()//the pin Gor the servo co//enable serial data printerial.begin&!55()erial.println&Jserver LED test 2.5 9999 ILE,A-E 7 LED#.ino J() // so I can eep trac

    void loop&(@// Create a client connectionEthernetClient client 7 server.available&()iG &client( @while &client.connected&(( @iG &client.available&(( @

    char c 7 client.read&()

    //read char b0 char H%%3 re$uestiG &readtring.length&( ; 255( @

    //store characters to stringreadtring '7 c)//erial.print&c()

    //iG H%%3 re$uest has endediG &c 77 KnK( @

    ///////////////erial.println&readtring() //print to serial monitor Gor debugingclient.println&JH%%3/2.2 #55 OMJ() //send new pageclient.println&JContent9%0pe: tet/htmlJ()client.println&()

    AA 2 16/0/13

  • 5/21/2018 Control+an+LED+over+the+Internet+using+the+Arduino+Ethernet+shield

    3/6

    client.println&J;H%-L

  • 5/21/2018 Control+an+LED+over+the+Internet+using+the+Arduino+Ethernet+shield

    4/6

    ,et1 go to the I3 Address: 2#.2!.2.2FF and turn on and oGG the LEDQ

    Open http://12.16.1.1/ in browser:

    E4IAL -O,I%O4 HOP:

    DEMO W/O ROUTER

    2/ 8E C4O9ORE4 E%HE4,E% CABLE %O CO,,EC% 3C * A4D8I,O E%HE4,E% HIELD

    #/ E% -A,8ALLN 3C I3 ADD4In Linu1 edit connections:

    elect wired connection S clic on EDI4 >TUVWVXYZ[\Z? :

    AA 16/0/13

    http://192.168.1.177/http://192.168.1.177/http://192.168.1.177/
  • 5/21/2018 Control+an+LED+over+the+Internet+using+the+Arduino+Ethernet+shield

    5/6

    6/ -anuall0 insert an I3 address oG the same subnet 2#.2!.2/#] &ie1 2#.2!.2.(1 such as2#.2!.2.25) insert subnet mas #.#.#.5.

    ]/ %hen chec 0our I3 addr with iGconGig.

    / %hen ping 2#.2!.2.2FF >A4D8I,O E%HE4,E% HIELD?:

    AA 16/0/13

  • 5/21/2018 Control+an+LED+over+the+Internet+using+the+Arduino+Ethernet+shield

    6/6

    !/ Open http://2#.2!.2.2FF/ in browser and switch LED on/oGG.

    Downloaded Grom http://t9h.wiispaces.com/arduino

    AA 6 16/0/13

    http://192.168.1.177/http://192.168.1.177/http://t-h.wikispaces.com/arduinohttp://192.168.1.177/http://t-h.wikispaces.com/arduino