Greetings all. It’s been awhile since I posted, 3 years already, wow.
Anyways, the powermonitor I built those years ago has been faithfully chugging along giving reports.
Now I’m updating to use an esp32 and an ads1115 (actually 4) so I can add 16 sensors. I found the ads library from i2cdevlib, and also found the minor adjustment to the emonlib to allow for ads1115 redirects by following the post by PaulWieland on github.
So added the following code to the main:
// Make a callback method for reading the pin value from the ADS instance
int ads1115PinReader(int _pin){
return ads.readADC_SingleEnded(_pin);
}
Because I have an array for the ads:
ADS1115 ads[] = {0x48, 0x49, 0x4A, 0x4B};
I have to loop through them. I’m using the following:
int sensor = 0;
for (int i = 0; i < ADC_COUNT; i++)
{
//e_monitor[i].current(SCT1_SensorPin, SCT1_CURRENT_CAL); // Current: input pin, calibration.
for (int j = 0; j < 4; j++)
{
e_monitor[sensor++].inputPinReader = ads1115PinReader(i, j);
}
}
Problem is, I keep getting compile errors:
current-volt_sensor_esp32:107:60: error: invalid conversion from 'int' to 'EnergyMonitor::inputPinReaderMethod {aka int (*)(int)}' [-fpermissive]
e_monitor[sensor++].inputPinReader = ads1115PinReader(i, j);
^
I’m not sure what I need to do to fix this problem.
Any help, suggestions, better way to accomplish the task?
Thanks,
Kori
Edit - formatted text. BT, Moderator