Reputation: 1053
I reset the ESP32-S3 board and uploaded simple blink code, but nothing happens
#define LED_BUILTIN 48
void setup() {
// put your setup code here, to run once:
pinMode(LED_BUILTIN,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED_BUILTIN,HIGH);
delay(1000);
digitalWrite(LED_BUILTIN,LOW);
delay(1000);
}
Upvotes: 1
Views: 616
Reputation: 1
use the following example code as it is neopixle from adafruit.
#include <Adafruit_NeoPixel.h>
#define PIN 48
#define NUMPIXELS 1
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
#define DELAYVAL 500
void setup () {
pixels.begin();
}
void loop () {
pixels.clear();
for(int i=0; i<NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(0, 150, 0));
pixels.show();
delay(DELAYVAL);
}
}
Upvotes: -1
Reputation: 3736
ESP32 Arduino platform for some ESP32 boards in pins_arduino.h
has a definition of LED_BUILTIN
. For example for the "ESP32S3 Dev Module" it is:
#define PIN_NEOPIXEL 48
static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT+PIN_NEOPIXEL;
#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN
#define RGB_BUILTIN LED_BUILTIN
#define RGB_BRIGHTNESS 64
The LED_BUILTIN
here has a strange value SOC_GPIO_PIN_COUNT+PIN_NEOPIXEL
. This is to distinguish normal use of the IO pin from use for the on-board RGB LED. In digitalWrite
if the pin is RGB_BUILTIN
they invoke neopixelWrite
instead of gpio_set_level
which is executed for all normal IO pins including 48.
The neopixelWrite
function then uses the Neopixel protocol to communicate with the on-board RGB LED.
So don't redefine LED_BUILTIN
but use the one already defined in pins_arduino.h
.
Upvotes: 2
Reputation: 1053
I checked with Serial Monitor and it printed the value exactly, so what I did, I just removed #define LED_BUILTIN 48
and it worked.
Here is the final working Code.
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000);
Serial.println("LED Test");// wait for a second
}
Upvotes: 0