NewEncoder icon indicating copy to clipboard operation
NewEncoder copied to clipboard

IDE/Wokwi naming conflict with https://github.com/alexitoo00/NewEncoder

Open drf5n opened this issue 1 month ago • 0 comments

I tried to use the examples in Wokwi, which uses the same library-discovery scheme as the IDE, and ended up installing the https://github.com/alexitoo00/NewEncoder library, which has a different API.

Example:

https://wokwi.com/projects/421075739324994561

sketch.ino:14:38: error: 'FULL_PULSE' was not declared in this scope
 NewEncoder encoder(2, 3, -20, 20, 0, FULL_PULSE);
                                      ^~~~~~~~~~
sketch.ino: In function 'void setup()':
sketch.ino:18:15: error: 'EncoderState' is not a member of 'NewEncoder'
   NewEncoder::EncoderState state;
               ^~~~~~~~~~~~
sketch.ino:24:22: error: no matching function for call to 'NewEncoder::begin()'
   if (!encoder.begin()) {
                      ^
In file included from sketch.ino:9:0:
/libraries/NewEncoder/src/NewEncoder.h:72:6: note: candidate: void NewEncoder::begin(uint8_t, uint8_t, uint8_t, int)
 void NewEncoder::begin(uint8_t clk, uint8_t data, uint8_t button, int resolution)
      ^~~~~~~~~~
/libraries/NewEncoder/src/NewEncoder.h:72:6: note:   candidate expects 4 arguments, 0 provided
In file included from sketch.ino:9:0:
/libraries/NewEncoder/src/NewEncoder.h:62:6: note: candidate: void NewEncoder::begin(uint8_t, uint8_t, uint8_t)
 void NewEncoder::begin(uint8_t clk, uint8_t data, uint8_t button)
      ^~~~~~~~~~
/libraries/NewEncoder/src/NewEncoder.h:62:6: note:   candidate expects 3 arguments, 0 provided
/libraries/NewEncoder/src/NewEncoder.h:51:6: note: candidate: void NewEncoder::begin(uint8_t, uint8_t)
 void NewEncoder::begin(uint8_t clk, uint8_t data)
      ^~~~~~~~~~
/libraries/NewEncoder/src/NewEncoder.h:51:6: note:   candidate expects 2 arguments, 0 provided
sketch.ino:30:13: error: 'class NewEncoder' has no member named 'getState'; did you mean 'clkState'?
     encoder.getState(state);
             ^~~~~~~~
             clkState
sketch.ino:30:22: error: 'state' was not declared in this scope
     encoder.getState(state);
                      ^~~~~
sketch.ino:30:22: note: suggested alternative: 'static'
     encoder.getState(state);
                      ^~~~~
                      static
sketch.ino: In function 'void loop()':
sketch.ino:39:15: error: 'EncoderState' is not a member of 'NewEncoder'
   NewEncoder::EncoderState currentEncoderState;
               ^~~~~~~~~~~~
sketch.ino:41:15: error: 'class NewEncoder' has no member named 'getState'; did you mean 'clkState'?
   if (encoder.getState(currentEncoderState)) {
               ^~~~~~~~
               clkState
sketch.ino:41:24: error: 'currentEncoderState' was not declared in this scope
   if (encoder.getState(currentEncoderState)) {
                        ^~~~~~~~~~~~~~~~~~~
sketch.ino:41:24: note: suggested alternative: 'prevEncoderValue'
   if (encoder.getState(currentEncoderState)) {
                        ^~~~~~~~~~~~~~~~~~~
                        prevEncoderValue
sketch.ino:49:26: error: 'UpClick' is not a member of 'NewEncoder'
         case NewEncoder::UpClick:
                          ^~~~~~~
sketch.ino:53:26: error: 'DownClick' is not a member of 'NewEncoder'
         case NewEncoder::DownClick:
                          ^~~~~~~~~

Error during build: exit status 1

drf5n avatar Jan 25 '25 18:01 drf5n