Encountered this error after downloading github zip file and extracting and then
compiling ino example file.
IDE 2 preferences:
https://dl.espressif.com/dl/package_esp32_index.json
https://github.com/danpeig/ESP32EnergyMonitor.git
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
ino sketch:
// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3
#include "EmonLib.h" // Include Emon Library
EnergyMonitor emon1; // Create an instance
void setup()
{
Serial.begin(9600);
emon1.voltage(2, 234.26, 1.7); // Voltage: input pin, calibration, phase_shift
emon1.current(1, 111.1); // Current: input pin, calibration.
}
void loop()
{
emon1.calcVI(20,2000); // Calculate all. No.of half wavelengths (crossings), time-out
emon1.serialprint(); // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
float realPower = emon1.realPower; //extract Real Power into variable
float apparentPower = emon1.apparentPower; //extract Apparent Power into variable
float powerFactor = emon1.powerFactor; //extract Power Factor into Variable
float supplyVoltage = emon1.Vrms; //extract Vrms into Variable
float Irms = emon1.Irms; //extract Irms into Variable
Serial.println();
Serial.print(realPower);
Serial.println();
Serial.print(apparentPower);
Serial.println();
Serial.print(powerFactor);
Serial.println();
Serial.print(supplyVoltage);
Serial.println();
Serial.print(Irms);
}
partial error printout (it was really big but just directory stuff and no messaging):
/sdk/esp32/include/espressif__esp-dsp/modules/fft/include -I/home/ed/.arduino15/packages/esp32/hardware/esp32/2.0.14/tools/sdk/esp32/include/espressif__esp-dsp/modules/dct/include -I/home/ed/.arduino15/packages/esp32/hardware/esp32/2.0.14/tools/sdk/esp32/include/espressif__esp-dsp/modules/conv/include -I/home/ed/.arduino15/packages/esp32/hardware/esp32/2.0.14/tools/sdk/esp32/include/espressif__esp-dsp/modules/common/include -I/home/ed/.arduino15/packages/esp32/hardware/esp32/2.0.14/tools/sdk/esp32/include/espressif__esp-dsp/modules/kalman/ekf/include -I/home/ed/.arduino15/packages/esp32/hardware/esp32/2.0.14/tools/sdk/esp32/include/espressif__esp-dsp/modules/kalman/ekf_imu13states/include -I/home/ed/.arduino15/packages/esp32/hardware/esp32/2.0.14/tools/sdk/esp32/include/fb_gfx/include -I/home/ed/.arduino15/packages/esp32/hardware/esp32/2.0.14/tools/sdk/esp32/qio_qspi/include -mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -ggdb -freorder-blocks -Wwrite-strings -fstack-protector -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -std=gnu++11 -fexceptions -fno-rtti -MMD -c -Wall -Werror=all -Wextra -Os -DF_CPU=240000000L -DARDUINO=10607 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ESP32 "-DARDUINO_BOARD=\"ESP32_DEV\"" "-DARDUINO_VARIANT=\"esp32\"" -DARDUINO_PARTITION_default -DESP32 -DCORE_DEBUG_LEVEL=0 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -DARDUINO_USB_CDC_ON_BOOT=0 @/tmp/arduino/sketches/D909CD5C9048558D00B5469470FF92A2/build_opt.h @/tmp/arduino/sketches/D909CD5C9048558D00B5469470FF92A2/file_opts -I/home/ed/.arduino15/packages/esp32/hardware/esp32/2.0.14/cores/esp32 -I/home/ed/.arduino15/packages/esp32/hardware/esp32/2.0.14/variants/esp32 -I/home/ed/Arduino/libraries/EmonLib /home/ed/Arduino/libraries/EmonLib/EmonLib.cpp -o /tmp/arduino/sketches/D909CD5C9048558D00B5469470FF92A2/libraries/EmonLib/EmonLib.cpp.o
/home/ed/Arduino/libraries/EmonLib/EmonLib.cpp: In member function 'long int EnergyMonitor::readVcc()':
/home/ed/Arduino/libraries/EmonLib/EmonLib.cpp:232:8: error: unused variable 'result' [-Werror=unused-variable]
long result;
^~~~~~
cc1plus: some warnings being treated as errors
Using library EmonLib at version 1.1.0 in folder: /home/ed/Arduino/libraries/EmonLib
exit status 1
Compilation error: exit status 1pe or paste code here