#define BITS 12
#define RED_LED_PIN 2
#define GREEN_LED_PIN 4
void setup(){
Serial.begin(115200);
pinMode(RED_LED_PIN, OUTPUT);
pinMode(GREEN_LED_PIN, OUTPUT);
analogSetAttenuation(ADC_11db);
analogSetWidth(BITS);
ledcSetup(0, 5000, BITS);
ledcSetup(1, 5000, BITS);
ledcAttachPin(RED_LED_PIN, 0);
ledcAttachPin(GREEN_LED_PIN, 1);
ledcWrite(1, 5000);
}
void loop(){
uint16_t val = analogRead(32);
Serial.printf("val= %u\n",val);
ledcWrite(0,val);
uint16_t green_val = val-4095;
ledcWrite(1,green_val);
delay(1000);
}