#include <Arduino_FreeRTOS.h>
int CT1,CT2,CT3;
class RGB{
public:
int PWM1,PWM2, PWM3;
RGB(int R, int G, int B){
PWM1=R;
PWM2=G;
PWM3=B;
}
};
RGB L(9,10,11);
void ledRGB( void *P){
int R= ((RGB)P).PWM1;
int G= ((RGB)P).PWM2;
int B= ((RGB)P).PWM3;
while (true){
analogWrite(R,CT1);
analogWrite(G,CT2);
analogWrite(B,CT3);
}
}
class potadc{
public:
int Adc1,Adc2,Adc3;
potadc(int A1, int A2, int A3){
Adc1=A1;
Adc2=A2;
Adc3=A3;
}
};
potadc Pt(A0,A1,A2);
void potenciometro(void *P){
int C1 = ((potadc)P).Adc1;
int C2 = ((potadc)P).Adc2;
int C3 = ((potadc)P).Adc3;
while(true){
CT1=analogRead(C1); vTaskDelay(1);
CT2=analogRead(C2); vTaskDelay(1);
CT3=analogRead(C3); vTaskDelay(1);
CT1=map(CT1,0,1023,0,255);
CT2=map(CT2,0,1023,0,255);
CT3=map(CT3,0,1023,0,255);
}
}
void setup() {
xTaskCreate(ledRGB,"RGB",128,(void*)&L,1,NULL);
xTaskCreate(potenciometro,"POT",128,(void*)&Pt,1,NULL);
}
void loop() {
// put your main code here, to run repeatedly:
}