typedef struct
{
int pin;
int time;
}aaa;
aaa a1,a2,a3;
void task(void*b)
{
  aaa led = *((aaa*)b);
//aaa*rrr = (aaa*)b;
//int pin = rrr->pin;
//int time = rrr->time;
int pin = led.pin;
int time = led.time;
pinMode(pin, OUTPUT);
while (1)
{
digitalWrite(pin,!digitalRead(pin));
vTaskDelay(time);
}
}
void setup()
{
a1.pin = 4;
a1.time = 1000;
a2.pin = 5;
a2.time = 2000;
a3.pin = 6;
a3.time = 3000;
xTaskCreate(task,"LED1",1024,&a1,1,NULL);
xTaskCreate(task,"LED2",1024,&a2,1,NULL);
xTaskCreate(task,"LED3",1024,&a3,1,NULL);
}
void loop(){

}
Loading
esp32-s3-devkitc-1