You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After making the changes defined in #1 and trying to recompile i get the following error:
Arduino\libraries\MCP4251\src\MCP4251.cpp:64:6: error: prototype for 'void MCP4251::DigitalPotSetWiperPosition(bool, unsigned int)' does not match any in class 'MCP4251'
void MCP4251::DigitalPotSetWiperPosition(bool potNum, unsigned int value)
^~~~~~~
In file included from Arduino\libraries\MCP4251\src\MCP4251.cpp:1:0:
Arduino\libraries\MCP4251\src\MCP4251.h:43:8: error: candidate is: void MCP4251::DigitalPotSetWiperPosition(bool, uint16_t)
void DigitalPotSetWiperPosition(bool potNum, uint16_t value); // Need confirmation if it is working
^~~~~~~~~~~~~~~~~~~~~~~~~~
exit status 1
Error compiling for board Arduino NANO 33 IoT.
To fix it i modified line 43 in MCP4251.h from:
void DigitalPotSetWiperPosition(bool potNum, uint16_t value); // Need confirmation if it is working
to
void DigitalPotSetWiperPosition(bool potNum, unsigned int value); // Need confirmation if it is working
With that change it now compiles. I'm unable to test if it actually works just yet but figured i would report this.
This is using Arduino IDE version: 1.8.16 and targeting an Arduino Nano 33 IOT.
I will report back about it physically working or not once ive got everything hooked up.
The text was updated successfully, but these errors were encountered:
Thank you for reporting the issue and suggesting appropriate changes.
and also for your kind appreciation to my work. I'm glad you are finding it useful...
Regarding the error, I think the issue arises because I have used unsigned int at
Using unsigned int makes code machine/compiler dependent, because of the bits allocated to int varies as per the micro controller (e.g. arduino uno vs due). Therefore, uint16_t is preferred, which always allocate same number of bits irrespective of the machine.
Your solution is also correct 👍
However, can you also test another future-proof solution by not making any change in MCP4251.h and instead replacing unsigned int by uint16_t in the MCP4251.cpp at
After making the changes defined in #1 and trying to recompile i get the following error:
To fix it i modified line
43
inMCP4251.h
from:void DigitalPotSetWiperPosition(bool potNum, uint16_t value); // Need confirmation if it is working
to
void DigitalPotSetWiperPosition(bool potNum, unsigned int value); // Need confirmation if it is working
With that change it now compiles. I'm unable to test if it actually works just yet but figured i would report this.
This is using Arduino IDE version: 1.8.16 and targeting an Arduino Nano 33 IOT.
I will report back about it physically working or not once ive got everything hooked up.
The text was updated successfully, but these errors were encountered: