3636 #define RED_LED 9
3737 #define GREEN_LED 6
3838 #define BLUE_LED 5
39+ #elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2)
40+ #define POWER_PIN 10
41+ #define RED_LED 0
42+ #define GREEN_LED 1
43+ #define BLUE_LED 2
44+ #define RED_PIN 11
45+ #define GREEN_PIN 12
46+ #define BLUE_PIN 13
47+ #define analogWrite ledcWrite
3948#elif defined(ESP32)
4049 #define POWER_PIN 33
41- #define RED_LED 0
42- #define GREEN_LED 1
43- #define BLUE_LED 2
44- #define RED_PIN 27
50+ #define RED_LED 0
51+ #define GREEN_LED 1
52+ #define BLUE_LED 2
53+ #define RED_PIN 27
4554 #define GREEN_PIN 12
4655 #define BLUE_PIN 13
4756 #define analogWrite ledcWrite
@@ -59,16 +68,17 @@ void setup() {
5968 digitalWrite (POWER_PIN, LOW);
6069
6170 // Set up the LED Pins
62- pinMode (RED_LED, OUTPUT);
63- pinMode (GREEN_LED, OUTPUT);
64- pinMode (BLUE_LED, OUTPUT);
65- #if defined(ESP32)
71+ #if defined(ESP32) // and ESP32-S2!
6672 ledcSetup (RED_LED, 5000 , 8 );
6773 ledcAttachPin (RED_PIN, RED_LED);
6874 ledcSetup (GREEN_LED, 5000 , 8 );
6975 ledcAttachPin (GREEN_PIN, GREEN_LED);
7076 ledcSetup (BLUE_LED, 5000 , 8 );
7177 ledcAttachPin (BLUE_PIN, BLUE_LED);
78+ #else
79+ pinMode (RED_LED, OUTPUT);
80+ pinMode (GREEN_LED, OUTPUT);
81+ pinMode (BLUE_LED, OUTPUT);
7282 #endif
7383
7484 analogWrite (RED_LED, 0 );
@@ -104,5 +114,5 @@ void loop()
104114 analogWrite (RED_LED, red);
105115 analogWrite (GREEN_LED, green);
106116 analogWrite (BLUE_LED, blue);
107- delay (100 );
117+ delay (2 );
108118}
0 commit comments