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

无法通过教程草图将数据从arduino mega上载到Cosm,c,upload,arduino,cosm,xively,C,Upload,Arduino,Cosm,Xively,我无法使用以太网将数据从我的Arduino Mega上传到Cosm。我尝试了其中一个教程示例()。我使用了Cosm在注册时提供给我的API密钥和提要ID,并将init()函数更改为使用静态IP地址,如下所示: byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0xD3, 0x45 }; IPAddress ip(192,168,0, 110); IPAddress gateway(192,168,0, 1); IPAddress subn

我无法使用以太网将数据从我的Arduino Mega上传到Cosm。我尝试了其中一个教程示例()。我使用了Cosm在注册时提供给我的API密钥和提要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);
// 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;
然后:

以下是串行监视器的输出:

Read sensor value 452.00 Uploading it to Cosm cosmclient.put returned -1 Read sensor value 451.00 Uploading it to Cosm cosmclient.put returned -1 Read sensor value 378.00 Uploading it to Cosm cosmclient.put returned -3 Read sensor value 352.00 Uploading it to Cosm cosmclient.put returned -3 读取传感器值452.00 上传到Cosm 返回的cosmclient.put-1 读取传感器值451.00 上传到Cosm 返回的cosmclient.put-1 读取传感器值378.00 上传到Cosm cosmclient.put返回-3 读取传感器值352.00 上传到Cosm cosmclient.put返回-3
有人对此有解决方案吗?

目前缺少相关文档,需要查看源代码才能找到答案。这些错误代码定义如下:

    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);
// 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;

毫不奇怪,你链接到的ino看起来是100%犹太教徒,我很难看到与我使用的不同之处

作为预防措施,我将 int-ret=0; 在循环开始时

我知道您只有一个传感器,但建议您仔细地将其标识为sensorId0

我有一个缓冲区

const int bufferSize=100;
char bufferValue[bufferSize];
CosmDatastream数据流[]={
CosmDatastream(传感器ID0、strlen(传感器ID0)、数据流\u FLOAT),

去年10月在cosm论坛上发布了完整的瓶子


我不使用ip、网关和子网之类的东西。这可能会弄脏水。

我看过cosm论坛,我知道arduino无法与pachube服务器通信。但我不明白为什么。如果我尝试用DHCP启动以太网,像这样:ethernet.begin(mac)有时数据会到达pachube…这对我来说仍然是一个谜!有人可以帮助吗?谢谢!使用DHCP可能是调试这个的一个良好开端…很可能是IP配置的问题。