diff --git a/src/extras/PwmPin.cpp b/src/extras/PwmPin.cpp index 1ad9556..5b58a9f 100644 --- a/src/extras/PwmPin.cpp +++ b/src/extras/PwmPin.cpp @@ -97,7 +97,6 @@ LedPin::LedPin(uint8_t pin, uint8_t level){ } enabled=true; - this->pin=pin; if(numChannels==0){ // first instantiation of an LedPin ledc_timer_config_t ledTimer; diff --git a/src/extras/PwmPin.h b/src/extras/PwmPin.h index 4aadbd9..509f048 100644 --- a/src/extras/PwmPin.h +++ b/src/extras/PwmPin.h @@ -29,7 +29,6 @@ class PwmPin { ///////////////////////////////////// class LedPin { - uint8_t pin; boolean enabled=false; ledc_channel_config_t ledChannel; static uint8_t numChannels; @@ -37,7 +36,7 @@ class LedPin { public: LedPin(uint8_t pin, uint8_t level=0); // assigns pin to be output of one of 16 PWM channels within initial level void set(uint8_t level); // sets the PWM duty to level (0-100) - int getPin(){return pin;} // returns the pin number + int getPin(){return ledChannel.gpio_num;} // returns the pin number static void HSVtoRGB(float h, float s, float v, float *r, float *g, float *b ); // converts Hue/Saturation/Brightness to R/G/B diff --git a/src/extras/extras.ino b/src/extras/extras.ino index e69cea3..8ce5b29 100644 --- a/src/extras/extras.ino +++ b/src/extras/extras.ino @@ -6,7 +6,7 @@ //ServoPin servo(3,18,-90); ServoPin servo(3,18,0,500,2200,-90,90); - + void setup(){ Serial.begin(115200); @@ -16,6 +16,7 @@ void setup(){ Serial.println("Starting..."); + LedPin yellow(16); LedPin d1(19); LedPin d2(19); @@ -33,7 +34,7 @@ void setup(){ LedPin d14(19); LedPin d15(19); LedPin d16(19); - LedPin red(17); + LedPin red(17); while(1){ for(int i=0;i<100;i++){