@ScruffR thank you very much for the help with the start. I proceeded forward without a magicNumber, but wondered if this is necessary or optional?
For my configuration code (i.e. writing to EEPROM) I have;
const uint32_t baseAddress = 0x00000000;
struct ConnectionData {
char Hostname[128];
char DeviceId[32];
char SharedAccessKey[64];
};
void setup() {
ConnectionData cd = { "companyname-iothub-dev.azure-devices.net", "XXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" };
EEPROM.put(baseAddress, cd);
pinMode(D7, OUTPUT);
digitalWrite(D7, HIGH);
}
void loop() {
}
The Argon on board LED is in fact on so I believe this to have been a successful operation. I was now going to Particle.publish the EEPROM data and verify that it worked. I went ahead and put it into the off the shelf AzureIotHubCleintV2 library, but have run into some errors. For your reference this is the setup portion of the github library;
// This #include statement was automatically added by the Particle IDE.
#include "ArduinoJson.h"
#include "AzureIotHubClient.h"
#define CONNECTION_STRING "<Your Azure IoT Hub or Azure IoT Central Connection String>"
int count = 0;
int msgId = 0;
char telemetryBuffer[256];
IotHub hub(CONNECTION_STRING);
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
RGB.control(true);
Time.zone(0);
}
I then created this;
// This #include statement was automatically added by the Particle IDE.
#include <AzureIotHubClientV2.h>
#include <ArduinoJson.h>
const uint32_t baseAddress = 0x00000000;
const char *connStringFormat = "HostName=%s;DeviceId=%s,SharedAccessKey=%s";
struct ConnectionData {
char HostName[128];
char DeviceId[32];
char SharedAccessKey[64];
};
ConnectionData cd
EEPROM.get(baseAddress, cd);
char connString[256];
snprintf(connString, sizeof(connString)
, connStringFormat,
, cd.HostName
, cd.DeviceID
, cd.SharedAccessKey
);
IotHub hub(connString);
int count = 0;
int msgId = 0;
char telemetryBuffer[256];
void setup()
{
Particle.publish("ConnectionString", String(connString), PRIVATE);
pinMode(LED_BUILTIN, OUTPUT);
RGB.control(true);
Time.zone(0);
}
Right now I am receiving 2 errors’
Any further help would be greatly appreciated.