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

Compilation error on Arduino MKR 1010 wifi #15

Open
meehollak opened this issue May 5, 2024 · 1 comment
Open

Compilation error on Arduino MKR 1010 wifi #15

meehollak opened this issue May 5, 2024 · 1 comment

Comments

@meehollak
Copy link

Apologies if this is the wrong place for this. I am trying to compile the example code that ran on my Uno over to an MKR 1010 but now getting compile errors. Specifically…

/Users/adam/Dropbox (Personal)/Arduino/libraries/ZMPT101B/src/ZMPT101B.cpp: In member function 'float ZMPT101B::getRmsVoltage(uint8_t)':
/Users/adam/Dropbox (Personal)/Arduino/libraries/ZMPT101B/src/ZMPT101B.cpp:60:55: error: 'ADC_SCALE' was not declared in this scope
   readingVoltage += sqrt(Vsum / measurements_count) / ADC_SCALE * VREF * sensitivity;
                                                       ^~~~~~~~~
/Users/adam/Dropbox (Personal)/Arduino/libraries/ZMPT101B/src/ZMPT101B.cpp:60:67: error: 'VREF' was not declared in this scope
   readingVoltage += sqrt(Vsum / measurements_count) / ADC_SCALE * VREF * sensitivity;
                                                                   ^~~~

Any thoughts as to what is going on?

@lukyanetsv
Copy link

@meehollak you should add microcontroller MKR1010 into the library like this:

#if defined(AVR)
	#define ADC_SCALE 1023.0f
	#define VREF 5.0f
#elif defined(ESP8266)
	#define ADC_SCALE 1023.0
	#define VREF 3.3
#elif defined(ESP32)
	#define ADC_SCALE 4095.0
	#define VREF 3.3
#endif

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

No branches or pull requests

2 participants