<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
		<id>http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=Microduino_ENC_Network_%287%29</id>
		<title>Microduino ENC Network (7) - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=Microduino_ENC_Network_%287%29"/>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Microduino_ENC_Network_(7)&amp;action=history"/>
		<updated>2026-04-21T09:49:24Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=Microduino_ENC_Network_(7)&amp;diff=2501&amp;oldid=prev</id>
		<title>Pkj：Created page with &quot;{{Language | Microduino ENC网络（七）}} {| style=&quot;width: 800px;&quot; |- | ==Objective== This tutorial will show you how to control a LED from a web page.  ==Equipment== *'''[...&quot;</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=Microduino_ENC_Network_(7)&amp;diff=2501&amp;oldid=prev"/>
				<updated>2014-05-06T13:30:33Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Language | Microduino ENC网络（七）}} {| style=&amp;quot;width: 800px;&amp;quot; |- | ==Objective== This tutorial will show you how to control a LED from a web page.  ==Equipment== *&amp;#039;&amp;#039;&amp;#039;[...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Language | Microduino ENC网络（七）}}&lt;br /&gt;
{| style=&amp;quot;width: 800px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
==Objective==&lt;br /&gt;
This tutorial will show you how to control a LED from a web page.&lt;br /&gt;
&lt;br /&gt;
==Equipment==&lt;br /&gt;
*'''[[Microduino-Core]]'''&lt;br /&gt;
*'''[[Microduino-FT232R]]'''&lt;br /&gt;
*'''[[Microduino-ENC28J60]]'''&lt;br /&gt;
*'''[[Microduino-RJ45]]'''&lt;br /&gt;
&lt;br /&gt;
*Other equipment&lt;br /&gt;
**USB cable &lt;br /&gt;
&lt;br /&gt;
==A bit of HTML==&lt;br /&gt;
First, you need to write an HTML page that will be the web interface Arduino sends to your web browser:&lt;br /&gt;
[[File:htmlcode.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
This web page is very simple: a label about LED’s actual status and a button to change it.&lt;br /&gt;
&lt;br /&gt;
Looking at page’s HTML source, you can identify the variable elements; i.e. the elements  that change according to the LED’s status:&lt;br /&gt;
&lt;br /&gt;
From the source, you can also understand what’s going to happen when the user clicks the button: his browser will ask to Arduino a web page named:&lt;br /&gt;
&lt;br /&gt;
/?status=ON, if the LED has to be turned on&lt;br /&gt;
/?status=OFF, if the LED has to be turned off&lt;br /&gt;
The use of ?name=value to send data to a web server reflects the standard syntax of HTML forms using the GET method.&lt;br /&gt;
&lt;br /&gt;
==Schematic==&lt;br /&gt;
*Microduino-ENC28J60&lt;br /&gt;
*Microduino-RJ45&lt;br /&gt;
*Microduino-Core&lt;br /&gt;
*Microduino-FT232R&lt;br /&gt;
Stack all modules and then connect the ethernet cable, as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:MicroduinoENCLED.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
==Program==&lt;br /&gt;
&lt;br /&gt;
Refer to ENCnetworkseven&lt;br /&gt;
&lt;br /&gt;
==Debug==&lt;br /&gt;
Step 1：Download the EtherCard library and copy to your libraries fold of IDE, then restart IDE.&lt;br /&gt;
https://github.com/jcw/ethercard&lt;br /&gt;
&lt;br /&gt;
Step 2：Explain the program:&lt;br /&gt;
&lt;br /&gt;
//Two static strings (ON, OFF) and two variables are defined: the variables will be used in HTML page creation, associating to them one of the two static strings.&lt;br /&gt;
&lt;br /&gt;
    char* on = &amp;quot;ON&amp;quot;;&lt;br /&gt;
    char* off = &amp;quot;OFF&amp;quot;;&lt;br /&gt;
    char* statusLabel;&lt;br /&gt;
　　char* buttonLabel;&lt;br /&gt;
&lt;br /&gt;
//In the setup(), in addition to EtherCard library setup, LED’s initial status (off) is configured.&lt;br /&gt;
&lt;br /&gt;
      pinMode(ledPin, OUTPUT);&lt;br /&gt;
      digitalWrite(ledPin, LOW);&lt;br /&gt;
      ledStatus = false;&lt;br /&gt;
&lt;br /&gt;
//In the main loop(), our sketch parse browser’s request (saved in Ethernet::buffer buffer starting from pos position) looking for status ON/OFF commands.&lt;br /&gt;
&lt;br /&gt;
        if(strstr((char *)Ethernet::buffer + pos, &amp;quot;GET /?status=ON&amp;quot;) != 0) {&lt;br /&gt;
          Serial.println(&amp;quot;Received ON command&amp;quot;);&lt;br /&gt;
          ledStatus = true;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        if(strstr((char *)Ethernet::buffer + pos, &amp;quot;GET /?status=OFF&amp;quot;) != 0) {&lt;br /&gt;
          Serial.println(&amp;quot;Received OFF command&amp;quot;);&lt;br /&gt;
          ledStatus = false;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
//The status of ledPin (Arduino’s PIN the LED is connected to) is updated and the two string variables are associated to the correct labels:&lt;br /&gt;
&lt;br /&gt;
        if(ledStatus) {&lt;br /&gt;
          digitalWrite(ledPin, HIGH);&lt;br /&gt;
          statusLabel = on;&lt;br /&gt;
          buttonLabel = off;&lt;br /&gt;
        } else {&lt;br /&gt;
          digitalWrite(ledPin, LOW);&lt;br /&gt;
          statusLabel = off;&lt;br /&gt;
          buttonLabel = on;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
Step 3: Connect the bulb, as follws:&lt;br /&gt;
[[File:connectLED.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
Step 4：Copile the code and download it.&lt;br /&gt;
&lt;br /&gt;
Step 5：Use the browser to access the Microduino's IP, then click ON/OFF, observe the bulb's state.&lt;br /&gt;
&lt;br /&gt;
==Result==&lt;br /&gt;
&lt;br /&gt;
Access Microduino's IP, you will see following picture：&lt;br /&gt;
[[File:LEDWebPage.jpg|600px|center|thumb]]&lt;br /&gt;
&lt;br /&gt;
Then you can use the browser to control the bulb.&lt;br /&gt;
&lt;br /&gt;
==Video==&lt;br /&gt;
&lt;br /&gt;
http://v.youku.com/v_show/id_XNzAzMzM0NzUy.html&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pkj</name></author>	</entry>

	</feed>