Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Larduino with emonlib not working

I am using Larduino LGT8F328 board then it seems can not compile code using your EmonLib
how to make it working?
all efforts are appreciated :slight_smile:

Welcome to the OEM forum.

Unfortunately, if you do not say what is wrong, nobody can help you. Please read Frequently Asked Questions - #2 by Bill.Thomson and then tell us what you have tried to do, and what the result is.

EmonLib was designed for the Arduino Uno and the ATMega 328P processor. If you use a different Arduino with a different processor, you must expect that you must make changes so that it will work.

could you please guide me to do changes to let emonlib work with LGT8F328 ?

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\hitro\AppData\Local\Arduino15\packages -hardware C:\Users\hitro\Documents\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\hitro\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\hitro\Documents\Arduino\libraries -fqbn=lgt8fx-master:lgt8f:328:arduino_isp=disable,clock_source=internal,clock=32MHz,variant=modelP -ide-version=10810 -build-path C:\Users\hitro\AppData\Local\Temp\arduino_build_346184 -warnings=none -build-cache C:\Users\hitro\AppData\Local\Temp\arduino_cache_835002 -prefs=build.warn_data_percentage=75 -verbose C:\Users\hitro\AppData\Local\Temp\arduino_modified_sketch_404146\sketch_mar29a.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\hitro\AppData\Local\Arduino15\packages -hardware C:\Users\hitro\Documents\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\hitro\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\hitro\Documents\Arduino\libraries -fqbn=lgt8fx-master:lgt8f:328:arduino_isp=disable,clock_source=internal,clock=32MHz,variant=modelP -ide-version=10810 -build-path C:\Users\hitro\AppData\Local\Temp\arduino_build_346184 -warnings=none -build-cache C:\Users\hitro\AppData\Local\Temp\arduino_cache_835002 -prefs=build.warn_data_percentage=75 -verbose C:\Users\hitro\AppData\Local\Temp\arduino_modified_sketch_404146\sketch_mar29a.ino
Using board '328' from platform in folder: C:\Users\hitro\Documents\Arduino\hardware\lgt8fx-master\lgt8f
Using core 'lgt8f' from platform in folder: C:\Users\hitro\Documents\Arduino\hardware\lgt8fx-master\lgt8f
Detecting libraries used...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DSERIAL_RX_BUFFER_SIZE=64 -DCLOCK_SOURCE=1 -DF_CPU=32000000L -DARDUINO=10810 -DARDUINO_AVR_LARDU_328E -DARDUINO_ARCH_LGT8F "-IC:\\Users\\hitro\\Documents\\Arduino\\hardware\\lgt8fx-master\\lgt8f\\cores\\lgt8f" "-IC:\\Users\\hitro\\Documents\\Arduino\\hardware\\lgt8fx-master\\lgt8f\\variants\\lgt8fx8p" "C:\\Users\\hitro\\AppData\\Local\\Temp\\arduino_build_346184\\sketch\\sketch_mar29a.ino.cpp" -o nul
Alternatives for EmonLib.h: [[email protected]]
ResolveLibrary(EmonLib.h)
  -> candidates: [[email protected]]
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DSERIAL_RX_BUFFER_SIZE=64 -DCLOCK_SOURCE=1 -DF_CPU=32000000L -DARDUINO=10810 -DARDUINO_AVR_LARDU_328E -DARDUINO_ARCH_LGT8F "-IC:\\Users\\hitro\\Documents\\Arduino\\hardware\\lgt8fx-master\\lgt8f\\cores\\lgt8f" "-IC:\\Users\\hitro\\Documents\\Arduino\\hardware\\lgt8fx-master\\lgt8f\\variants\\lgt8fx8p" "-IC:\\Users\\hitro\\Documents\\Arduino\\libraries\\EmonLib-master" "C:\\Users\\hitro\\AppData\\Local\\Temp\\arduino_build_346184\\sketch\\sketch_mar29a.ino.cpp" -o nul
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DSERIAL_RX_BUFFER_SIZE=64 -DCLOCK_SOURCE=1 -DF_CPU=32000000L -DARDUINO=10810 -DARDUINO_AVR_LARDU_328E -DARDUINO_ARCH_LGT8F "-IC:\\Users\\hitro\\Documents\\Arduino\\hardware\\lgt8fx-master\\lgt8f\\cores\\lgt8f" "-IC:\\Users\\hitro\\Documents\\Arduino\\hardware\\lgt8fx-master\\lgt8f\\variants\\lgt8fx8p" "-IC:\\Users\\hitro\\Documents\\Arduino\\libraries\\EmonLib-master" "C:\\Users\\hitro\\Documents\\Arduino\\libraries\\EmonLib-master\\EmonLib.cpp" -o nul
Generating function prototypes...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DSERIAL_RX_BUFFER_SIZE=64 -DCLOCK_SOURCE=1 -DF_CPU=32000000L -DARDUINO=10810 -DARDUINO_AVR_LARDU_328E -DARDUINO_ARCH_LGT8F "-IC:\\Users\\hitro\\Documents\\Arduino\\hardware\\lgt8fx-master\\lgt8f\\cores\\lgt8f" "-IC:\\Users\\hitro\\Documents\\Arduino\\hardware\\lgt8fx-master\\lgt8f\\variants\\lgt8fx8p" "-IC:\\Users\\hitro\\Documents\\Arduino\\libraries\\EmonLib-master" "C:\\Users\\hitro\\AppData\\Local\\Temp\\arduino_build_346184\\sketch\\sketch_mar29a.ino.cpp" -o "C:\\Users\\hitro\\AppData\\Local\\Temp\\arduino_build_346184\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Program Files (x86)\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\hitro\\AppData\\Local\\Temp\\arduino_build_346184\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DSERIAL_RX_BUFFER_SIZE=64 -DCLOCK_SOURCE=1 -DF_CPU=32000000L -DARDUINO=10810 -DARDUINO_AVR_LARDU_328E -DARDUINO_ARCH_LGT8F "-IC:\\Users\\hitro\\Documents\\Arduino\\hardware\\lgt8fx-master\\lgt8f\\cores\\lgt8f" "-IC:\\Users\\hitro\\Documents\\Arduino\\hardware\\lgt8fx-master\\lgt8f\\variants\\lgt8fx8p" "-IC:\\Users\\hitro\\Documents\\Arduino\\libraries\\EmonLib-master" "C:\\Users\\hitro\\AppData\\Local\\Temp\\arduino_build_346184\\sketch\\sketch_mar29a.ino.cpp" -o "C:\\Users\\hitro\\AppData\\Local\\Temp\\arduino_build_346184\\sketch\\sketch_mar29a.ino.cpp.o"
In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,

                 from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:90,

                 from C:\Users\hitro\Documents\Arduino\hardware\lgt8fx-master\lgt8f\cores\lgt8f/Arduino.h:28,

                 from C:\Users\hitro\AppData\Local\Temp\arduino_build_346184\sketch\sketch_mar29a.ino.cpp:1:

C:\Users\hitro\Documents\Arduino\hardware\lgt8fx-master\lgt8f\cores\lgt8f/lgtx8p.h:590:17: error: expected unqualified-id before 'volatile'

 #define VCAL    _SFR_MEM8(0xC8)

                 ^

C:\Users\hitro\Documents\Arduino\libraries\EmonLib-master/EmonLib.h:76:12: note: in expansion of macro 'VCAL'

     double VCAL;

            ^~~~

C:\Users\hitro\Documents\Arduino\hardware\lgt8fx-master\lgt8f\cores\lgt8f/lgtx8p.h:590:17: error: expected ')' before 'volatile'

 #define VCAL    _SFR_MEM8(0xC8)

                 ^

C:\Users\hitro\Documents\Arduino\libraries\EmonLib-master/EmonLib.h:76:12: note: in expansion of macro 'VCAL'

     double VCAL;

            ^~~~

C:\Users\hitro\Documents\Arduino\hardware\lgt8fx-master\lgt8f\cores\lgt8f/lgtx8p.h:590:17: error: expected ')' before 'volatile'

 #define VCAL    _SFR_MEM8(0xC8)

                 ^

C:\Users\hitro\Documents\Arduino\libraries\EmonLib-master/EmonLib.h:76:12: note: in expansion of macro 'VCAL'

     double VCAL;

            ^~~~

Multiple libraries were found for "EmonLib.h"
 Used: C:\Users\hitro\Documents\Arduino\libraries\EmonLib-master
Using library EmonLib-master at version 1.1.0 in folder: C:\Users\hitro\Documents\Arduino\libraries\EmonLib-master 
exit status 1
Error compiling for board LGT8F328.

I think your problem is in the file C:\Users\hitro\Documents\Arduino\hardware\lgt8fx-master\lgt8f\cores\lgt8f/lgtx8p.h. This is not part of emonLib. I think you must ask for help on a Larduino forum.