Updated LedPin()
This commit is contained in:
parent
bc498c32e4
commit
59e34fde05
|
|
@ -97,7 +97,6 @@ LedPin::LedPin(uint8_t pin, uint8_t level){
|
||||||
}
|
}
|
||||||
|
|
||||||
enabled=true;
|
enabled=true;
|
||||||
this->pin=pin;
|
|
||||||
|
|
||||||
if(numChannels==0){ // first instantiation of an LedPin
|
if(numChannels==0){ // first instantiation of an LedPin
|
||||||
ledc_timer_config_t ledTimer;
|
ledc_timer_config_t ledTimer;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ class PwmPin {
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
|
|
||||||
class LedPin {
|
class LedPin {
|
||||||
uint8_t pin;
|
|
||||||
boolean enabled=false;
|
boolean enabled=false;
|
||||||
ledc_channel_config_t ledChannel;
|
ledc_channel_config_t ledChannel;
|
||||||
static uint8_t numChannels;
|
static uint8_t numChannels;
|
||||||
|
|
@ -37,7 +36,7 @@ class LedPin {
|
||||||
public:
|
public:
|
||||||
LedPin(uint8_t pin, uint8_t level=0); // assigns pin to be output of one of 16 PWM channels within initial level
|
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)
|
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
|
static void HSVtoRGB(float h, float s, float v, float *r, float *g, float *b ); // converts Hue/Saturation/Brightness to R/G/B
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
//ServoPin servo(3,18,-90);
|
//ServoPin servo(3,18,-90);
|
||||||
ServoPin servo(3,18,0,500,2200,-90,90);
|
ServoPin servo(3,18,0,500,2200,-90,90);
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
@ -16,6 +16,7 @@ void setup(){
|
||||||
|
|
||||||
Serial.println("Starting...");
|
Serial.println("Starting...");
|
||||||
|
|
||||||
|
|
||||||
LedPin yellow(16);
|
LedPin yellow(16);
|
||||||
LedPin d1(19);
|
LedPin d1(19);
|
||||||
LedPin d2(19);
|
LedPin d2(19);
|
||||||
|
|
@ -33,7 +34,7 @@ void setup(){
|
||||||
LedPin d14(19);
|
LedPin d14(19);
|
||||||
LedPin d15(19);
|
LedPin d15(19);
|
||||||
LedPin d16(19);
|
LedPin d16(19);
|
||||||
LedPin red(17);
|
LedPin red(17);
|
||||||
|
|
||||||
while(1){
|
while(1){
|
||||||
for(int i=0;i<100;i++){
|
for(int i=0;i<100;i++){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue