Open GabriCattazz01 opened 2 years ago
For atmega4809 make this change inside emonlib.cpp file:
delay(2); ADC0.COMMAND = ADC_STCONV_bm; while (ADC0.INTFLAGS & ADC_RESRDY_bm == 0) ; result = ADC0.RES; ADC0.INTFLAGS = ADC_RESRDY_bm; result = READVCC_CALIBRATION_CONST / result; // 1100mV*1024 ADC steps http://openenergymonitor.org/emon/node/1186 return result;
return (3300); // Arduino Due
return (3300); // Guess that other un-supported architectures will be running a 3.3V!
}
Hi guys, we have bought the newest arduino nano every for our IOT projects and to monitoring houses consumptions.
However, we have seen that your library does not yet support these models... The arduino compiler gives us this ADC register error :
/* C:\Users\Mauro\Documents\Arduino\libraries\EmonLib-master\EmonLib.cpp: In member function 'long int EnergyMonitor::readVcc()': C:\Users\Mauro\Documents\Arduino\libraries\EmonLib-master\EmonLib.cpp:253:3: error: 'ADCSRA' was not declared in this scope ADCSRA |= _BV(ADSC); // Convert ^
~C:\Users\Mauro\Documents\Arduino\libraries\EmonLib-master\EmonLib.cpp:253:3: note: suggested alternative: 'ADC_t' ADCSRA |= _BV(ADSC); // Convert ^~ADC_tADCSRA |= _BV(ADSC); // Convert ^ C:\Users\Mauro\Documents\Arduino\libraries\EmonLib-master\EmonLib.cpp:253:17: note: suggested alternative: 'DDRC' C:\Users\Mauro\Documents\Arduino\libraries\EmonLib-master\EmonLib.cpp:255:12: error: 'ADCL' was not declared in this scope result = ADCL; ^~~~ C:\Users\Mauro\Documents\Arduino\libraries\EmonLib-master\EmonLib.cpp:255:12: note: suggested alternative: 'ADC0' result = ADCL; ^~~~ ADC0 C:\Users\Mauro\Documents\Arduino\libraries\EmonLib-master\EmonLib.cpp:256:13: error: 'ADCH' was not declared in this scope result |= ADCH<<8; ^~~~ C:\Users\Mauro\Documents\Arduino\libraries\EmonLib-master\EmonLib.cpp:256:13: note: suggested alternative: 'ADC0' result |= ADCH<<8; ^~~~ ADC0 */
Would you able to integrate this model in your library? Thanks!