Added the cpp and platformio.ini
This commit is contained in:
13
README.md
13
README.md
@@ -1,2 +1,15 @@
|
||||
# esp32-simple-test
|
||||
|
||||
## IDE
|
||||
|
||||
### PlattformIO
|
||||
A PlatformIO ```platformio.ini``` is included with the uncommented part being for an ```ESP-32D``` and the commented part for ```ESP32-C3```
|
||||
|
||||
### ArduinoIDE
|
||||
You need to configure the ESP32 you are using. But keep in mind that for some the ```CDC_ON_BOOT``` may be disabled by default and needed to be renabled.
|
||||
|
||||
## License
|
||||
This project is licensed under the Apache License 2.0 - see the [LICENSE](./LICENSE) file for details.
|
||||
|
||||
### AI
|
||||
Portions of this code were generated with the assistance of ChatGPT (OpenAI GPT-5).
|
||||
37
platformio.ini
Normal file
37
platformio.ini
Normal file
@@ -0,0 +1,37 @@
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; Upload options: custom upload port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
; Advanced options: extra scripting
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
; [env:esp32-c3-devkitm-1]
|
||||
; platform = espressif32
|
||||
; board = esp32-c3-devkitm-1
|
||||
; framework = arduino
|
||||
|
||||
; monitor_speed = 115200
|
||||
|
||||
; build_flags =
|
||||
; -DARDUINO_USB_CDC_ON_BOOT=1
|
||||
; -DARDUINO_USB_MODE=1
|
||||
|
||||
; lib_deps =
|
||||
; adafruit/Adafruit SSD1306 @ ^2.5.7
|
||||
; adafruit/Adafruit GFX Library @ ^1.11.7
|
||||
|
||||
[env:esp32dev]
|
||||
platform = espressif32
|
||||
board = esp32dev
|
||||
framework = arduino
|
||||
upload_speed = 115200
|
||||
monitor_speed = 115200
|
||||
|
||||
; Explicit flash settings for stability
|
||||
board_build.flash_mode = dio
|
||||
board_build.flash_size = 4MB
|
||||
board_build.flash_freq = 40m
|
||||
|
||||
21
src/main.cpp
Normal file
21
src/main.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
void setup() {
|
||||
// USB CDC Serial (enabled by ARDUINO_USB_CDC_ON_BOOT)
|
||||
Serial.begin(115200);
|
||||
|
||||
// Optional: wait until host opens the port
|
||||
while (!Serial) {
|
||||
delay(10);
|
||||
}
|
||||
|
||||
Serial.println("✅ ESP32-C3 USB CDC Serial is enabled!");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
static uint32_t counter = 0;
|
||||
|
||||
Serial.print("Loop counter: ");
|
||||
Serial.println(counter++);
|
||||
delay(1000);
|
||||
}
|
||||
Reference in New Issue
Block a user