Connection between esp8266 and azure iot

DEDISE:

I confirmed the following with the esp32 THING PLUS I purchased at your company.

Content

I used the following ardino software.

As a result, it was displayed normally on device explorer.

I want to reproduce this content.

I want to replace this software with esp8266.

Please tell me how.

ARDUINO SOFT

==

/**
 * A simple Azure IoT example for sending telemetry.
 */

#include <WiFi.h>
#include "Esp32MQTTClient.h"

// Please input the SSID and password of WiFi
const char* ssid     = "ssid";
const char* password = "pass";

/*String containing Hostname, Device Id & Device Key in the format:                         */
/*  "HostName=<host_name>;DeviceId=<device_id>;SharedAccessKey=<device_key>"                */
/*  "HostName=<host_name>;DeviceId=<device_id>;SharedAccessSignature=<device_sas_token>"    */
static const char* connectionString =  "device exploler id";


static bool hasIoTHub = false;

void setup() {
  Serial.begin(115200);
  Serial.println("Starting connecting WiFi.");
  delay(10);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  if (!Esp32MQTTClient_Init((const uint8_t*)connectionString))
  {
    hasIoTHub = false;
    Serial.println("Initializing IoT hub failed.");
    return;
  }
  hasIoTHub = true;
}

void loop() {
int IOTA0;
int IOTA6;
const char* ESP32A0;

IOTA0 = analogRead(A0);
IOTA6 = analogRead(A6);
//ESP32A0=(const char *)IOTA0;
  
  Serial.println("start sending events.");
  if (hasIoTHub)
  {
    char buff[128];


    snprintf(buff, 128, "%d:%d:" ,IOTA0,IOTA6);
    if (Esp32MQTTClient_SendEvent(buff))
    {
      Serial.println("Sending data succeed");
    }
    else
    {
      Serial.println("Failure...");
    }
    delay(5000);
  }
}

Hi @NY20200803!

There is a new embedded SDK for Azure IoT that I recommend you give a try. Just follow the instructions [here.

Let me know if you have any issue or question!](https://github.com/Azure/azure-sdk-for-c/blob/master/sdk/samples/iot/docs/how_to_iot_hub_esp8266_nodemcu.md)

Thank you very much. I’ll try it immediately.

If you like

For WINDOWS 10

Please tell me how to get the “azure-sdk-for-c.zip” library.

Reason: What I searched for on the website

Because it cannot be captured.

Hello!

Click the entry describing the SDK, then click code. On the drop down select Zip and download the file. Use your favorite tool to decompress.

Can be set with ESP8266

It is in “Esp32 MQTT Client.h”

Please tell me the next function.

“bool Esp32MQTTClient_Init(const uint8_t* deviceConnString, bool hasDeviceTwin = false, bool traceOn = false);”

And

“Bool Esp32MQTTClient_SendEvent(const char *text);”

For the following reasons

Because it is necessary.

The sketch example for ESP8266 is over memory even after compiling,

I can’t compile.

And

“Azure-sdk-for-c.zip” library"

When I tried to import it in the Ardino library,

I get an error.

NY20200803:
Can be set with ESP8266

It is in “Esp32 MQTT Client.h”

Please tell me the next function.

“bool Esp32MQTTClient_Init(const uint8_t* deviceConnString, bool hasDeviceTwin = false, bool traceOn = false);”

And

“Bool Esp32MQTTClient_SendEvent(const char *text);”

For the following reasons

Because it is necessary.

The sketch example for ESP8266 is over memory even after compiling,

I can’t compile.

And

“Azure-sdk-for-c.zip” library"

When I tried to import it in the Ardino library,

I get an error.

As I understand it, you want to have the Arduino IDE make use of it. There should be a sample sketch, I believe that should be imported into it. There should also be instructions for doing the rest.

Thank you very much for contacting me.

Sorry for the late contact.

With the following contents,

I will work on it at a later date.

If there is a misinterpretation,

please tell me.

I told you immediately

https://github.com/Azure/azure-sdk-for- … sp8266.ino

I will try using.

This time

Currently, the following files are not available,

“//#Include <az_result.h>”

“//#Include <az_span.h>”

“//#Include <az_iot_hub_client.h>”

“//#Include “iot_configs.h””

https://github.com/Azure/azure-sdk-for-c/issues/59

I will try while making it referring to.

I have to prioritize other things, so

I will do the work later.

Hello!

I believe the headers you are looking for could be found also within the same archive.


Serendipity means a fortunate accident. Eureka does not mean what you think it means.