How to communicate with AZURE using HTTP protocol with ESP32

NY20200803
Posts: 29
Joined: Sun Aug 09, 2020 2:27 am

How to communicate with AZURE using HTTP protocol with ESP32

Postby NY20200803 » Mon Nov 23, 2020 9:57 am

Transmission format;
JSON
protocol;
Http
Available at
Do you have sample software?
Soft; Aruduino
The reason is that it is necessary to write in Arduino in order to match the radio wave specifications in Japan.

For example
Of the sample below
HTTP protocol
It is the data of the control in.
(Sketch example ESP32 AZURE IOT Arduino → Software that can be opened with SimpleMQTT)
===
/**
* 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 = "";
const char* password = "";

/*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 = "";

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() {
Serial.println("start sending events.");
if (hasIoTHub)
{
char buff[128];

// replace the following line with your data sent to Azure IoTHub
snprintf(buff, 128, "{\"topic\":\"iot\"}");

if (Esp32MQTTClient_SendEvent(buff))
{
Serial.println("Sending data succeed");
}
else
{
Serial.println("Failure...");
}
delay(5000);
}
}

==

Even if you look at various libraries,
Nothing tells you the contents of the header file
etc
There is
I can't find out how to do it here
in trouble.

Please. Help me.

I have some hints
It can be trivial.

Who is online

Users browsing this forum: lbernstone and 76 guests