我正在尝试设置一个从Arduino MKR1000向Azure IOT Event Hub发送消息的基本示例,但似乎无法使任何在线示例正常工作,并且我是Arduino的新手。
任何有关简单工作示例的指针?
我尝试了此示例,并稍作更改以发布消息而不是接收消息,但没有运气。我可以毫无问题地连接到Wifi,只是在发布HTTP请求时出现错误,并显示“ HTTP错误411。该请求必须分块或具有内容长度”。这似乎也不是最干净的方法,但我只是不想立即开始一些基本操作:)
代码示例:
#include <SPI.h>
#include <WiFi101.h>
#include "arduino_secrets.h"
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
const int MKR1000_LED = 6 ;
///*** Azure IoT Hub Config ***///
//see: http://mohanp.com/ for details on getting this right if you are not sure.
char hostname[] = "*****.azure-devices.net"; // …
Run Code Online (Sandbox Code Playgroud)