Hi Bob,
That is exactly the path I was going down after finding the learning curve to use Platform IO a bit steep and using the Arduino IDE to compile the firmware was an alternative, so thanks for confirming this was the right way to go.
I have now tried compiling the following code using the IDE and I get a message " error: ‘EEPROM’ does not name a type".
#include “IotaWatt.h”
//*************************************** Process the EEPROM ****************************************
EEprom* EE = new EEprom;
uint8_t* EEbytes = (uint8_t*) EE;
size_t EEsize = sizeof(EEprom);
// Initialize the EEprom for testing.
// Ordinarily this is done in manufacturing but homegrown users
// can activate this code to initialize their EEprom.
EEPROM.begin();
memcpy(EE->id, “IoTaWatt”, 8);
EE->EEversion = 0;
EE->deviceMajorVersion = 5;
EE->deviceMinorVersion = 0;
EE->mfgDate = 0;
EE->mfgLot = 0;
EE->mfgBurden = 20;
EE->mfgRefVolts = 2500;
for(int i=0; i<20; i++){
EEPROM.write(i,EEbytes[i]);
}
// EEPROM.end();
EEPROM.begin(EEsize);
for(int i=0; i<EEsize; i++){
EEbytes[i] = EEPROM.read(i);
}
if( ! memcmp(EE->id, “IoTaWatt”, 8)){
if(EE->EEversion > 0){
log("EEPROM unrecognized version %d", EE->EEversion);
} else {
deviceMajorVersion = EE->deviceMajorVersion;
deviceMinorVersion = EE->deviceMinorVersion;
VrefVolts = (float)EE->mfgRefVolts / 1000.0;
}
}
EEPROM.end();
delete EE;
EE = nullptr;
}
I do appreciate that this is a “homebrew version” and I need to go down a learning path myself, (and I am certainly learning), but any pointers on what the actual EEPROM type issue is, would be appreciated as I am very keen to get the board operational, as the information it will provide is very important for a planned house switchboard upgrade in the near future.