Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino Wifi rev 2 compatibility #56

Open
1omarsaid opened this issue Feb 27, 2020 · 3 comments
Open

Arduino Wifi rev 2 compatibility #56

1omarsaid opened this issue Feb 27, 2020 · 3 comments
Labels

Comments

@1omarsaid
Copy link

1omarsaid commented Feb 27, 2020

It doesnt seem like this library works with the arduino uno wifi rev 2 due to the change of the analog pin names. I get the following error:


/Users/omarsaid/Documents/Arduino/libraries/EmonLib-master/EmonLib.cpp: In member function 'long int EnergyMonitor::readVcc()':
/Users/omarsaid/Documents/Arduino/libraries/EmonLib-master/EmonLib.cpp:251:3: error: 'ADCSRA' was not declared in this scope
   ADCSRA |= _BV(ADSC);                             // Convert
   ^~~~~~
/Users/omarsaid/Documents/Arduino/libraries/EmonLib-master/EmonLib.cpp:251:3: note: suggested alternative: 'ADC_t'
   ADCSRA |= _BV(ADSC);                             // Convert
   ^~~~~~
   ADC_t
In file included from /Users/omarsaid/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/avr/include/avr/io.h:99:0,
                 from /Users/omarsaid/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/avr/include/avr/pgmspace.h:90,
                 from /Users/omarsaid/Library/Arduino15/packages/arduino/hardware/megaavr/1.8.5/cores/arduino/api/String.h:30,
                 from /Users/omarsaid/Library/Arduino15/packages/arduino/hardware/megaavr/1.8.5/cores/arduino/api/Print.h:24,
                 from /Users/omarsaid/Library/Arduino15/packages/arduino/hardware/megaavr/1.8.5/cores/arduino/api/Stream.h:25,
                 from /Users/omarsaid/Library/Arduino15/packages/arduino/hardware/megaavr/1.8.5/cores/arduino/api/Client.h:22,
                 from /Users/omarsaid/Library/Arduino15/packages/arduino/hardware/megaavr/1.8.5/cores/arduino/api/ArduinoAPI.h:29,
                 from /Users/omarsaid/Library/Arduino15/packages/arduino/hardware/megaavr/1.8.5/cores/arduino/Arduino.h:23,
                 from /Users/omarsaid/Documents/Arduino/libraries/EmonLib-master/EmonLib.h:15,
                 from /Users/omarsaid/Documents/Arduino/libraries/EmonLib-master/EmonLib.cpp:13:
/Users/omarsaid/Documents/Arduino/libraries/EmonLib-master/EmonLib.cpp:251:17: error: 'ADSC' was not declared in this scope
   ADCSRA |= _BV(ADSC);                             // Convert
                 ^
/Users/omarsaid/Documents/Arduino/libraries/EmonLib-master/EmonLib.cpp:251:17: note: suggested alternative: 'ADC0'
/Users/omarsaid/Documents/Arduino/libraries/EmonLib-master/EmonLib.cpp:253:12: error: 'ADCL' was not declared in this scope
   result = ADCL;
            ^~~~
/Users/omarsaid/Documents/Arduino/libraries/EmonLib-master/EmonLib.cpp:253:12: note: suggested alternative: 'ADC0'
   result = ADCL;
            ^~~~
            ADC0
/Users/omarsaid/Documents/Arduino/libraries/EmonLib-master/EmonLib.cpp:254:13: error: 'ADCH' was not declared in this scope
   result |= ADCH<<8;
             ^~~~
/Users/omarsaid/Documents/Arduino/libraries/EmonLib-master/EmonLib.cpp:254:13: note: suggested alternative: 'ADC0'
   result |= ADCH<<8;
             ^~~~
             ADC0
exit status 1
Error compiling for board Arduino Uno WiFi Rev2.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.```


Any way I can change the code to make it compatible with the arduino uno wifi rev 2? I know I need to make some changes to the "ADC" and looking online, I see that they changed the names to AIN but I am not sure exactly what to do.
@TrystanLea TrystanLea added the bug label Mar 16, 2020
@TrystanLea
Copy link
Member

Hello @1omarsaid we are not targeting support for Arduino Wifi so Im afraid it is not likely that this will be fixed. Let us know if you work out what is needed to fix

@J0J015JK
Copy link

J0J015JK commented Oct 5, 2021

I changed the registers so that Emonlib will work on the Arduino UNO WiFi
I called it EmonDIY so just change the #include Emonlib line to include EmonDIY
Download link => https://github.com/J0J015JK/EmonDIY

@gbtassara
Copy link

Dear J0J015JK, it seems your lib does not work on Arduino UNO WIFI rev2...
it seems that MUXPOS, REFSEL0, AIN1, AIN2, AIN3, ADCn.COMMAND, STCONV, ADCn.RESL, ADCn.RESH are not defined...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants