I am programming an ESP32 with Arduino IDE. Due to my specific application, my program reads analog signals from 8 ADC pins sequentially, just like the following code shows:
Code: Select all
adc[0] = analogReadMilliVolts(15);
adc[1] = analogReadMilliVolts(25);
adc[2] = analogReadMilliVolts(32);
adc[3] = analogReadMilliVolts(33);
adc[4] = analogReadMilliVolts(34);
adc[5] = analogReadMilliVolts(35);
adc[6] = analogReadMilliVolts(36);
adc[7] = analogReadMilliVolts(39);
Another question I have is somewhat similar to the above. Currently, my program also sets up multiple PWM channels sequentially, as shown in the following code. I am seeking a way to set up multiple channels simultaneously, therefore, multiple channels are synchronized and there is no delay due to the runtime required by sequentially executing the program.
Code: Select all
ledcChangeFrequency(13, parameter[0], timerResolution);
ledcWrite(13, parameter[1], parameter[2]);
ledcChangeFrequency(0, parameter[3], timerResolution);
ledcWrite(0, parameter[4], parameter[5]);
ledcChangeFrequency(1, parameter[6], timerResolution);
ledcWrite(1, parameter[7], parameter[8]);
ledcChangeFrequency(14, parameter[9], timerResolution);
ledcWrite(14, parameter[10], parameter[11]);