作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我无法通过以太网屏蔽从我的 Arduino Mega 上传数据到 Cosm。我尝试了其中一个教程示例 ( DatastreamUpload.ino
)。我使用了 Cosm 在注册时提供给我的 API key 和提要 ID,并将 init()
函数更改为使用静态 IP 地址,如下所示:
byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0xD3, 0x45 };
IPAddress ip(192,168,0, 110);
IPAddress gateway(192,168,0, 1);
IPAddress subnet(255, 255, 255, 0);
然后:
Ethernet.begin(mac, ip, gateway, subnet);
这是串行监视器的输出:
Read sensor value 452.00Uploading it to Cosmcosmclient.put returned -1Read sensor value 451.00Uploading it to Cosmcosmclient.put returned -1Read sensor value 378.00Uploading it to Cosmcosmclient.put returned -3Read sensor value 352.00Uploading it to Cosmcosmclient.put returned -3
有人对此有解决方案吗?
最佳答案
目前缺少这方面的文档,需要查看源代码才能找到答案。这些错误代码在 HttpClient.h
中定义如下:
// The end of the headers has been reached. This consumes the '\n'
static const int HTTP_SUCCESS =0;
// Could not connect to the server
static const int HTTP_ERROR_CONNECTION_FAILED =-1;
// This call was made when the HttpClient class wasn't expecting it
// to be called. Usually indicates your code is using the class
// incorrectly
static const int HTTP_ERROR_API =-2;
// Spent too long waiting for a reply
static const int HTTP_ERROR_TIMED_OUT =-3;
// The response from the server is invalid, is it definitely an HTTP
// server?
static const int HTTP_ERROR_INVALID_RESPONSE =-4;
关于无法通过教程草图将数据从arduino mega上传到Cosm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16178873/
我是一名优秀的程序员,十分优秀!