#include <Arduino_FreeRTOS.h>
int C1, C2, C3;
class ledRGB{
public:
int PWM1, PWM2, PWM3;
ledRGB(int R, int G, int B){
PWM1=R; PWM2=G; PWM3=B;
}
};
ledRGB L(9,10,11);
void RGB(void *p){
int R=(*(ledRGB*)p).PWM1;
int G=(*(ledRGB*)p).PWM2;
int B=(*(ledRGB*)p).PWM3;
while(1){
analogWrite(R,C1);
analogWrite(G,C2);
analogWrite(B,C3);
}
}
class Potadc{
public:
int Adc1,Adc2,Adc3;
Potadc(int A, int B, int C){
Adc1=A; Adc2=B; Adc3=C;
}
};
Potadc P(A0,A1,A2);
void Potenciometro(void * p){
int A=(*(Potadc*)p).Adc1;
int B=(*(Potadc*)p).Adc2;
int C=(*(Potadc*)p).Adc3;
while(1)
{
C1=analogRead(A);
C2=analogRead(B);
C3=analogRead(C);
C1=map(C1,0,1023,0,255);
C2=map(C2,0,1023,0,255);
C3=map(C3,0,1023,0,255);
}}
void setup() {
xTaskCreate(RGB,"LEDRGB",128,(void*)&L,1,NULL);
xTaskCreate(Potenciometro,"ADCs",128,(void*)&P,1,NULL);
}
void loop() {
// put your main code here, to run repeatedly:
}