I followed this link and installed library for ESP32C3 in Arduino IDE.
I tried to run the simple LED blinking code, but got nothing at serial monitor:
// define led according to pin diagram
int led = B10;
void setup() {
// initialize digital pin led as an output
pinMode(led, OUTPUT);
Serial.begin(115200);
}
void loop() {
Serial.println("LED HIGH");
digitalWrite(led, HIGH); // turn the LED on
delay(1000); // wait for a second
Serial.println("LED low");
digitalWrite(led, LOW); // turn the LED off
delay(1000); // wait for a second
}
Here is IDE output for compiling and code uploading
Sketch uses 250966 bytes (19%) of program storage space. Maximum is 1310720 bytes.
Global variables use 13884 bytes (4%) of dynamic memory, leaving 313796 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.5.1
Serial port COM7
Connecting...
Chip is ESP32-C3 (revision v0.4)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 64:e8:33:11:8f:58
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00003fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00050fff...
Compressed 13200 bytes to 9522...
Writing at 0x00000000... (100 %)
Wrote 13200 bytes (9522 compressed) at 0x00000000 in 0.2 seconds (effective 425.2 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.1 seconds (effective 391.1 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 586.7 kbit/s)...
Hash of data verified.
Compressed 262336 bytes to 146515...
Writing at 0x00010000... (11 %)
Writing at 0x0001b060... (22 %)
Writing at 0x00022f65... (33 %)
Writing at 0x000296b0... (44 %)
Writing at 0x0002f6a2... (55 %)
Writing at 0x000358fe... (66 %)
Writing at 0x0003b5f5... (77 %)
Writing at 0x00043c00... (88 %)
Writing at 0x00049f54... (100 %)
Wrote 262336 bytes (146515 compressed) at 0x00010000 in 2.1 seconds (effective 1002.0 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Hello, sorry to see that your program is not running correctly, according to your code there is generally no problem, if you can see the LED flashing, please make sure that your serial port monitor, the COM port is correctly configured (the same as the burning COM port) and the baud rate is set to the same as the code
I didn’t link a LED. So no LED flashing.
One more issue: original code in the link use int led = D10;, which leads to compiling error. I have to change to B10.
BoardServicePackage : esp32 by Espressif Systems 2.0.14
Board Select : XIAO_ESP32C3
// define led according to pin diagram
int led = D10;
void setup() {
// initialize digital pin led as an output
pinMode(led, OUTPUT);
Serial.begin(115200);
}
void loop() {
Serial.println("LED HIGH");
digitalWrite(led, HIGH); // turn the LED on
delay(1000); // wait for a second
Serial.println("LED LOW");
digitalWrite(led, LOW); // turn the LED off
delay(1000); // wait for a second
}
You need to check if your code is not outputting from the serial port because of a logic problem. If you are using xiao esp32c3, we still recommend you to use Arduino
It’s the same code pasted by @msfujino.
OK, I connect ESP32C3 to an external sensor through SPI interface. The sensor draw power from ESP32C3’s 5v pin.
If I disconnect that 5v pin and GND from the sensor; the code is able to run if I reset C3 board.
As I read from this wiki, the power is drew directly from USB, and the sensor current in running mode is less than 10mA. The USB port should be able to handle.
What sensor (board?) are you connected to? And the connecting pins specifically?
Is the input/output of the sensor 3.3V? XIAO accepts only 3.3V input/output.