ARDUINO W5100 WebServer测试
1.直接下载官方的enternet->WebServer代码
/*
Web Server A simple web server that shows the value of the analog input pins.
using an Arduino Wiznet Ethernet shield. Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
* Analog inputs attached to pins A0 through A5 (optional) created 18 Dec 2009
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe */ #include <SPI.h>
#include <Ethernet.h> // Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(,,,); // Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(); void setup() {
// Open serial communications and wait for port to open:
Serial.begin();
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
} // start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
} void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
// output the value of each analog input pin
for (int analogChannel = ; analogChannel < ; analogChannel++) {
int sensorReading = analogRead(analogChannel);
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(sensorReading);
client.println("<br />");
}
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay();
// close the connection:
client.stop();
Serial.println("client disconnected");
}
}
打开串口调试助手显示网页IP
在浏览器输入192.168.1.177
串口监视器会显示GET信息
ARDUINO W5100 WebServer测试的更多相关文章
- ARDUINO W5100 WebClient 测试
基础工作:W5100扩展板插在ARDUINO上.用网线把W5100和自己家的路由器连接.插上网线能看到侧面网口指示灯变亮.路由器开启DHCP服务(一般都是开启的). 1.打开官方例程里面的Ethern ...
- PS2手柄在arduino上进行测试,可用,供喜欢diy的朋友借鉴
#include <PS2X_lib.h> //PS2手柄PS2X ps2x; // create PS2 Controller Class//////////PS2引脚///////// ...
- [Arduino] Arduino Uno R3 中文介绍
Arduino UNO是Arduino USB接口系列的最新版本,作为Arduino平台的参考标准模板.UNO的处理器核心是ATmega328,同时具有14路数字输入/输出口(其中6路可作为PWM输出 ...
- Arduino可穿戴教程之第一个程序——上传运行程序(四)
Arduino可穿戴教程之第一个程序——上传运行程序(四) 2.4.5 上传程序 现在所有Arduino IDE的设置都完成了,我们就可以将示例程序上传到板子中了.这非常简单,只需要单击如图2.45 ...
- Arduino UNO的原理图
Arduino UNO的原理图是开源的,所以可以从arduino网站上下载它: https://www.arduino.cc/en/Main/ArduinoBoardUno 原理图PDF: https ...
- Arduino UNO R3
Arduino 常见型号 当然还有 LilyPad,附图: 最常见的自然是UNO,最新版是第三版R3: 国内也有一些改进的板子.我用的是一般的板子,拿到货也只能默默了. 简介 The Uno is a ...
- Arduino+ESP32 之 驱动GC9A01圆形LCD(一),基于Arduino_GFX库
最近买了一块圆形屏幕,驱动IC是GC9A01,自己参考淘宝给的stm32的驱动例程, 在ubuntu下使用IDF开发ESP32,也在windows的vscode内安装IDF开发ESP32,虽然都做到了 ...
- CoopyIII开发文档之控制LED灯开关
作者:那年:QQ:843681152 一. CooplyIII环境的搭建 工欲善其事必先利器,如何搭建CooplyIII的开发环境是一切coolpyIII开发的前提.CoolpyIII作者内cool超 ...
- WiFi-ESP8266入门http(3-1)网页认证上网-post请求(原教程)
教程:http://geek-workshop.com/thread-37484-1-1.html 源码:链接:https://pan.baidu.com/s/1yuYYqsM-WSOb0AbyAT0 ...
随机推荐
- Vue笔记五
十二.过滤器(filter) 示例代码: <template> <div id="app"> {{ msg | capitalize }} </div ...
- javascript洗牌算法 乱序算法 面试题
1.2种方案代码 <!DOCTYPE html> <html lang="zh"> <head> <meta charset=" ...
- cocos2d-x 3.0 场景切换特效汇总
cocos2d-x 3.0中场景切换特效比較多,并且游戏开发中也常常须要用到这些特效.来使场景切换时不至于那么干巴,遂这里汇总一下,开发中使用. 场景切换用到导演类Directory,大多数用的都是替 ...
- iOS将数组中的内容分拼接成字符串
NSString *string = [array componentsJoinedByString:@","];--分隔符
- 改变UITextField的Placeholder颜色
通过 attributedPlaceholder 属性来改变 if([textField respondsToSelector:@selector(setAttributedPlaceholder:) ...
- video视频播放以及主流浏览器兼容
直接看代码吧! <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> < ...
- SQLServer中存储过程StoredProcedure创建及C#调用(转)
此文作为入门了解用,转自http://www.2cto.com/database/201502/378260.html 存储过程就是已经编译好的.优化过的放在数据库服务器中的一些SQL语句:可供应用程 ...
- Delphi 泛型(三十篇)
Delphi 泛型(三十篇)http://www.cnblogs.com/jxgxy/category/216671.html
- mariadb在线热备份做主从
yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noar ...
- Java中的equals方法和自定义比较器
Object中的equals()方法默认是按地址比较,而不按内容进行比较, public boolean equals(Object obj) { return (this == obj); } 在S ...