Arduino Uno - WebService(AzureML)

时间:2015-10-20 06:34:30

标签: web-services azure arduino-uno azure-machine-learning-studio

我想连接到AzureML Web服务。我已经查看了Arduino主页上的POST方法以及https://iotguys.wordpress.com/2014/12/25/communicating-with-microsoft-azure-eventhub-using-arduino/

这是我的安装方法:

    void setup()
    {
      Serial.begin(9600);
      while (!Serial) {
      ; // wait for serial port to connect.
      }

     Serial.println("ethernet");

     if (Ethernet.begin(mac) == 0) {
       Serial.println("ethernet failed");
       for (;;) ;
     }
    // give the Ethernet shield a second to initialize:
    delay(1000);
 }

Post方法基于:http://playground.arduino.cc/Code/WebClient

我刚刚使用sprintf(outBuf, "Authorization: Bearer %s\r\n", api_key);

char* api_key = "the ML Web Service API KEY"添加到标题中

此外,与WebClient中指定的不同,我将整个WebService URI用作url,并且不指定页面名称。

这不起作用。

我要连接的网络具有Internet访问权限。

我做错了什么?

1 个答案:

答案 0 :(得分:0)

您创建的Machine Learning Studio服务需要从具有SSL功能的设备接收请求以执行HTTPS请求。 AFAIK,Arduino不支持SSL功能。

一种常见的情况是将Arduino连接到第三个设备,如Raspberry Pi 2等,将其用作网关并从Pi本身进行呼叫。

以下是Microsoft Open Technologies团队的一个示例project,它使用了Arduino Uno,Raspberry pi和Azure。

希望这有帮助!