Updated LedPin()

This commit is contained in:
Gregg 2021-03-20 17:19:47 -05:00
parent bc498c32e4
commit 59e34fde05
3 changed files with 4 additions and 5 deletions

View File

@ -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;

View File

@ -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

View File

@ -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++){