搜索
系统检测到您的用户名不符合规范:

arduino+W5100+php交互问题

浏览:576 发布日期:2019年02月25日 分类:求助交流 关键字: arduino W5100 服务器 交互 单片机
本人在做一个门禁系统,通过arduino的W5100 GET方法发数据给服务器,arduino串口端收到的信息如下:

arduino代码如下:
void setup() {
pinMode(IC_Card, OUTPUT);
pinMode(elec_relay, OUTPUT);
digitalWrite(IC_Card,HIGH);
Serial.begin(9600);
led_out_put("APManagement");
Serial.println("APManagement");
//Serial.println("Failed to configure Ethernet using DHCP");
// Check for Ethernet hardware present
if (Ethernet.linkStatus() == linkOFF) {
led_out_put("Ethernet cable is not connected.");
}
Ethernet.begin(mac, ip, myDns);
delay(1000);

if (client.connect(server,80)) {
led_out_put("Send Message...");
Serial.println("Send Message...");
client.println("GET /index.php/index/mcucommu/getcode1");
client.println("HTTP/1.1");
client.println("Host:192.168.76.67");
client.println("Connection: close");
client.println();
} else {
// if you didn't get a connection to the server:
led_out_put("Connection Failed");
}

}

void loop() {
if(client.available()) {
char c = client.read();
Serial.print(c);
}

if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
led_out_put("disconnecting");
client.stop();

// do nothing forevermore:
while(true);
}
}
一直没有成功,我把服务器端传参都省略了。
<?php
namespace app\index\controller;
use think\Controller;
use think\Request;

class Mcucommu extends Controller{

public function getCode(){
/*- $request = Request::instance();
$mcu_ip=$request->ip(); //获取访问IP地址
$request->get();
$code=$request->param('id');
$ip_arry=config('mcu_ip'); //从配置文件获取注册MCU ip地址
$flag=false;
foreach ($ip_arry as $key => $value){
if($mcu_ip==$value){ //遍历IP地址是否存在
$flag=true;
break;
}
}
if ($flag){

return $code;

}else{
return 'error';
}-*/

return 'ok';

}

}
在电脑上访问getCode方法是好的,但单片机上就不行,IIS服务器的log也看了,GET方法和PC上的一样,但是传入和传出数据量相差很大。
最佳答案
收藏
hefeifei
积分:85 等级:LV0
热点推荐
(追記) (追記ここまで)
最新更新

我们

合作

网站

信息

ThinkPHP 是一个免费开源的,快速、简单的面向对象的 轻量级PHP开发框架 ,创立于2006年初,遵循Apache2开源协议发布,是为了敏捷WEB应用开发和简化企业应用开发而诞生的。ThinkPHP从诞生以来一直秉承简洁实用的设计原则,在保持出色的性能和至简的代码的同时,也注重易用性。并且拥有众多的原创功能和特性,在社区团队的积极参与下,在易用性、扩展性和性能方面不断优化和改进,已经成长为国内最领先和最具影响力的WEB应用开发框架,众多的典型案例确保可以稳定用于商业以及门户级的开发。

AltStyle によって変換されたページ (->オリジナル) /