2015-10-20 163 views
0

我想连接到AzureML Web服务。我已经调查的Arduino的首页POST方法和这里https://iotguys.wordpress.com/2014/12/25/communicating-with-microsoft-azure-eventhub-using-arduino/Arduino Uno - WebService(AzureML)

这里是我的设置方法:

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访问权限。

我在做什么错?

回答

0

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

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

以下是来自Microsoft Open Technologies团队的示例project,该团队利用Arduino Uno,Raspberry pi和Azure的东西。

希望这会有所帮助!