gpt4 book ai didi

无法通过教程草图将数据从arduino mega上传到Cosm

转载 作者:行者123 更新时间:2023-12-01 06:18:43 29 4
gpt4 key购买 nike

我无法通过以太网屏蔽从我的 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/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com