ShiftPWM library compile error

ChrisT

Member
I'm trying to use the ShiftPWM library to control 13 LEDs with 795 shift registers. I'm pretty sure I had this working a few months ago, so I suspect either I've done something wrong or an update to something has broken it. The compile error I get is:

Code:
c:\Users\*****\Documents\Arduino\libraries\ShiftPWM\CShiftPWM.cpp: In destructor 'CShiftPWM::~CShiftPWM()':
c:\Users\*****\Documents\Arduino\libraries\ShiftPWM\CShiftPWM.cpp:40:23: error: ordered comparison of pointer with integer zero ('unsigned char*' and 'int')
   40 |         if(m_PWMValues>0){
      |            ~~~~~~~~~~~^~
Multiple libraries were found for "ShiftPWM.h"
  Used: C:\Users\*****\Documents\Arduino\libraries\ShiftPWM
  Not used: C:\Users\*****\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\libraries\ShiftPWM
exit status 1

This is using a Teensy 4.1. I have freshly installed the library from https://github.com/PaulStoffregen/ShiftPWM, and am using the ShiftPWM_RGB_Example.ino file with these lines uncommented:

Code:
#define SHIFTPWM_NOSPI
const int ShiftPWM_dataPin = 1;
const int ShiftPWM_clockPin = 2;

I'd really like to use the RGB functionality, and really don't want to have to code it all myself! Can anyone help please? Thanks.
 
Seems like its using the "wrong" library. (Temporarily?) get rid of C:\Users\*****\Documents\Arduino\libraries\ShiftPWM and retry the build
 
Thanks for the quick response. I can see the code is now using the right (?) library, but the error is still the same:

Code:
C:\Users\*****\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\libraries\ShiftPWM\CShiftPWM.cpp: In destructor 'CShiftPWM::~CShiftPWM()':
C:\Users\*****\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\libraries\ShiftPWM\CShiftPWM.cpp:40:23: error: ordered comparison of pointer with integer zero ('unsigned char*' and 'int')
   40 |         if(m_PWMValues>0){
      |            ~~~~~~~~~~~^~

exit status 1

I see the code in the source github repo (https://github.com/elcojacobs/ShiftPWM) hasn't been updated in 12 years (except for a license file). Perhaps an update to the C++ language has broken it?
 
Back
Top