Skip to content

Commit 872bcb5

Browse files
committed
add RGB example
1 parent 0a485c7 commit 872bcb5

File tree

5 files changed

+109
-259
lines changed

5 files changed

+109
-259
lines changed

README.md

Lines changed: 4 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,15 @@
1-
# ESP32 project template
1+
# ESP32-C6 examples
22

33
## Description
44

5-
This is a project template to create microcontroller apps with automatized firmware builds for [esp32](https://www.espressif.com/en/products/socs/esp32), [esp32s2](https://www.espressif.com/en/products/socs/esp32-s2) and [esp32s3](https://www.espressif.com/en/products/socs/esp32-s3) microcontroller boards. It uses for that [GitHub Actions](https://github.com/features/actions) and [platformio](https://platformio.org/). Use this repository as a template for your own esp32 projects.
6-
7-
## Requirements
8-
9-
- [GitHub Actions](https://github.com/features/actions)
10-
- [platformio](https://platformio.org/)
11-
- [python](https://www.python.org/)
12-
13-
## GitHub Actions - Workflow
14-
15-
The release build happens in the `build & release` workflow: [build_release.yml](.github/workflows/build_release.yml).
16-
It creates a release, after creation of a new git tag (named it like `v1.0.0`).
17-
18-
If you want to test the build on all merge w/o creating a tag then the `build` workflow is what you looking for: [build.yml](.github/workflows/build.yml)
19-
20-
## PlatformIO
21-
22-
[PlatformIO](https://platformio.org/) is a tool to create microcontroller apps for arduino platforms and compatibles (esp32). You can install the [Visual Studio Code extension](https://platformio.org/install/ide?install=vscode) in the [Visual Studio Code](https://code.visualstudio.com/) IDE.
23-
24-
## Python
25-
26-
There is a tiny python script needed to customize the firmware filenames within platformio, see documentation: https://docs.platformio.org/en/stable/scripting/examples/custom_program_name.html
27-
28-
The [extra_script.py](extra_script.py) script gets the platformio env (e.g. lolin32) and the git-tag for the firmware filename.
29-
This is required to publish several firmware names in the github artifacts of a release.
30-
31-
## Get Started
32-
33-
<img src="doc/create-new-project-with-template.png" />
34-
35-
1. Login to github
36-
37-
2. Click on `Use this template` to create a new git repository
38-
3. Implement your application in the [src/main.cpp](src/main.cpp)
39-
4. Comment your new change in the [CHANGELOG.md](CHANGELOG.md) file
40-
5. Push your changes
41-
42-
```sh
43-
git add .
44-
```
45-
46-
```sh
47-
git commit -am "my app"
48-
```
49-
50-
```sh
51-
git push -u origin main
52-
```
53-
54-
5. Create a new tag to trigger a release, e.g. for v1.0.0
55-
56-
```sh
57-
git tag v1.0.0
58-
```
59-
60-
```sh
61-
git push origin v1.0.0
62-
```
63-
64-
6. You can find your firmwares under `Releases` after the CI build finished
65-
66-
## CHANGELOG
67-
68-
You can write your changes in the [CHANGELOG.md](CHANGELOG.md) before you create a release. It will be shown under the release page.
69-
70-
## Example Release
71-
72-
see [Releases](https://github.com/mcuw/esp-ghbuild-template/releases) on the right sidemenu.
73-
74-
## Customize your project
75-
76-
You can reduce and adapt your required boards in the [platformio.ini](platformio.ini).
77-
78-
Update the [CHANGELOG.md](CHANGELOG.md) file before you are creating a new release. By creating a new git tag you trigger a new release which generate for you the firmwares.
5+
Uncomment `src_dir=` in the `platform.ini` file.
796

807
## Supported boards
818

82-
- ESP32 (buy with affiliate link: [LILYGO T-Beam](https://s.click.aliexpress.com/e/_DBzslDV) with LoRA, lolin32, lolin D32 pro)
83-
- ESP32 S2
84-
- ESP32 S3 (buy with affiliate link: [LILYGO T-Display S3](https://s.click.aliexpress.com/e/_DBmOMkn), [LILYGO T-Display-S3 AMOLED](https://s.click.aliexpress.com/e/_DmboYpZ), [LILYGO T-Display-S3 Touch](https://s.click.aliexpress.com/e/_DCBgPlV), [LILYGO T-Display S3 Long](https://s.click.aliexpress.com/e/_Dl6UVMx))
859
- ESP32 C6 with WiFi 6 and BT-5 LE (buy with affiliate link: [UICPAL nanoESP32-C6](https://s.click.aliexpress.com/e/_DdZ83IB) with up to 16MB flash, [ESP32-C6](https://s.click.aliexpress.com/e/_DeLjVMb) with 4MB flash and W2812 RGB LED)
8610

11+
![datasheet - nanoESP32-C6](doc/nanoESP32C6.pdf)
12+
8713
## Disclaimer
8814

8915
Contribution and help ... if you find an issue or wants to contribute then please do not hesitate to create a merge request or an issue.

doc/nanoESP32C6.pdf

241 KB
Binary file not shown.

examples/rgb/main.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#include <Arduino.h>
2+
#include <Adafruit_NeoPixel.h>
3+
4+
// see https://github.com/wuxx/nanoESP32-C6
5+
// datasheet https://github.com/wuxx/nanoESP32-C6/blob/master/hardware/nanoESP32C6.pdf
6+
7+
#define DATA_PIN 8
8+
#define NUMPIXELS 1
9+
#define BRIGHTNESS 255
10+
11+
Adafruit_NeoPixel pixels(NUMPIXELS, DATA_PIN, NEO_GRB + NEO_KHZ800);
12+
13+
void setup()
14+
{
15+
Serial.begin(115200);
16+
while (!Serial)
17+
;
18+
19+
pixels.begin();
20+
pixels.show();
21+
pixels.setBrightness(BRIGHTNESS);
22+
}
23+
24+
void loop()
25+
{
26+
pixels.clear();
27+
28+
Serial.println("Rot");
29+
pixels.setPixelColor(0, pixels.Color(255, 0, 0));
30+
pixels.show(); // Send the updated pixel colors to the hardware.
31+
delay(1000);
32+
33+
Serial.println("Grün");
34+
pixels.setPixelColor(0, pixels.Color(0, 255, 0));
35+
pixels.show();
36+
delay(1000);
37+
38+
Serial.println("Blau");
39+
pixels.setPixelColor(0, pixels.Color(0, 0, 255));
40+
pixels.show();
41+
delay(1000);
42+
}

platformio.ini

Lines changed: 39 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,62 @@
1-
; https://docs.platformio.org/en/latest/platforms/espressif32.html
1+
; PlatformIO Project Configuration File
2+
;
3+
; Build options: build flags, source filter
4+
; Upload options: custom upload port, speed and extra flags
5+
; Library options: dependencies, extra library storages
6+
; Advanced options: extra scripting
7+
;
8+
; Please visit documentation for the other options and examples
9+
; https://docs.platformio.org/page/projectconf.html
210

311
[platformio]
412
boards_dir = ./boards
13+
; examples
14+
; src_dir = ./examples/rgb
515

616
[env]
7-
build_flags =
8-
; to use e.g. as part of the firmware name
9-
'-DPIOENV="${PIOENV}"'
10-
11-
; coding_standards
12-
-Wno-unused-variable
13-
-Wno-unused-but-set-variable
14-
-Wunreachable-code
15-
16-
; debug level 5=VERBOSE https://docs.platformio.org/en/latest/platforms/espressif32.html#debug-level
17-
; -DCORE_DEBUG_LEVEL=5
17+
build_flags =
18+
'-DPIOENV="${PIOENV}"'
19+
20+
-Wno-unused-variable
21+
-Wno-unused-but-set-variable
22+
-Wunreachable-code
1823
extra_scripts = pre:extra_script.py
1924
framework = arduino
20-
lib_deps =
21-
; place global libs here or under extra.lib_deps_external (see below)
25+
lib_deps =
2226
monitor_speed = 115200
2327
platform = espressif32
2428
upload_speed = 921600
2529

26-
; CUSTOM options
27-
; You need manually inject these options into a section
28-
; using ${extra.<name_of_option>} (see below)
2930
[extra]
30-
; https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/external-ram.html
31-
build_flags_psram =
32-
-DBOARD_HAS_PSRAM
33-
-mfix-esp32-psram-cache-issue ; https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/external-ram.html#esp32-rev-v1
31+
build_flags_psram =
32+
-DBOARD_HAS_PSRAM
33+
-mfix-esp32-psram-cache-issue
3434
lib_deps_builtin =
35-
SPI
36-
Wire
35+
SPI
36+
Wire
3737
lib_deps_external =
38-
; extend libs for all platforms here
38+
adafruit/Adafruit NeoPixel @ ^1.12.0
3939

4040
[esp32]
41-
build_flags =
42-
${env.build_flags}
43-
lib_deps =
44-
${env.lib_deps}
45-
${extra.lib_deps_builtin}
46-
${extra.lib_deps_external}
47-
; extend libs only for esp32 based modules here
41+
build_flags =
42+
${env.build_flags}
43+
lib_deps =
44+
${env.lib_deps}
45+
${extra.lib_deps_builtin}
46+
${extra.lib_deps_external}
4847

4948
[esp32c6]
50-
build_flags =
51-
${env.build_flags}
52-
lib_deps =
53-
${env.lib_deps}
54-
${extra.lib_deps_builtin}
55-
${extra.lib_deps_external}
56-
; extend libs only for esp32c6 based modules here
57-
platform = https://github.com/platformio/platform-espressif32.git
58-
platform_packages =
59-
platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
60-
platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-libs.git#idf-release/v5.1
61-
62-
[esp32s2]
63-
build_flags =
64-
${env.build_flags}
65-
lib_deps =
66-
${env.lib_deps}
67-
${extra.lib_deps_builtin}
68-
${extra.lib_deps_external}
69-
; extend libs only for esp32s2 based modules here
70-
71-
[esp32s3]
72-
build_flags =
73-
${env.build_flags}
74-
lib_deps =
75-
${env.lib_deps}
76-
${extra.lib_deps_builtin}
77-
${extra.lib_deps_external}
78-
; extend libs only for esp32s3 based modules here
79-
80-
81-
; *********
82-
; * ESP32 *
83-
; *********
84-
85-
; pio board config: https://docs.platformio.org/en/latest/platforms/espressif32.html
86-
[env:esp32dev]
87-
extends = esp32
88-
board = esp32dev
89-
build_flags =
90-
${esp32.build_flags}
91-
lib_deps =
92-
${esp32.lib_deps}
93-
94-
; pio board config: https://docs.platformio.org/en/latest/boards/espressif32/lolin32.html
95-
[env:lolin32]
96-
extends = esp32
97-
board = lolin32
98-
build_flags =
99-
${esp32.build_flags}
100-
lib_deps =
101-
${esp32.lib_deps}
102-
103-
; Wemos https://www.wemos.cc/en/latest/d32/d32_pro.html
104-
; pio board config: https://docs.platformio.org/en/latest/boards/espressif32/lolin_d32_pro.html
105-
[env:lolin-d32-pro]
106-
extends = esp32
107-
board = lolin_d32_pro
108-
build_flags =
109-
${esp32.build_flags}
110-
${extra.build_flags_psram} ; 4MB PSRAM
49+
build_flags =
50+
${env.build_flags}
11151
lib_deps =
112-
${esp32.lib_deps}
52+
${env.lib_deps}
53+
${extra.lib_deps_builtin}
54+
${extra.lib_deps_external}
11355

114-
; LILYGO https://www.lilygo.cc/products/t-beam-v1-1-esp32-lora-module
115-
[env:ttgo-t-beam]
116-
extends = esp32
117-
board = ttgo-t-beam
118-
build_flags =
119-
${esp32.build_flags}
120-
${extra.build_flags_psram} ; 8MB PSRAM
121-
lib_deps =
122-
${esp32.lib_deps}
123-
124-
; ************
125-
; * ESP32-C6 *
126-
; ************
127-
; devkitc-1: https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html
128-
; devkitm-1: https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitm-1/index.html
56+
platform = https://github.com/platformio/platform-espressif32.git
57+
platform_packages =
58+
platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
59+
platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-libs.git#idf-release/v5.1
12960

13061
[env:esp32-c6-n16]
13162
extends = esp32c6
@@ -134,70 +65,3 @@ board = esp32-c6-n16
13465
[env:esp32-c6-n4]
13566
extends = esp32c6
13667
board = esp32-c6-n4
137-
138-
; ************
139-
; * ESP32-S2 *
140-
; ************
141-
142-
; TODO http://www.lilygo.cn/prod_view.aspx?TypeId=50033&Id=1321 with psram
143-
; repository: https://github.com/Xinyuan-LilyGO/LilyGo-T-Display-S2
144-
[env:lilygo-t-display-s2]
145-
extends = esp32s2
146-
board = esp32dev ; what about platformio board support and an own?
147-
148-
; ************
149-
; * ESP32-S3 *
150-
; ************
151-
152-
; pio board config: https://docs.platformio.org/en/latest/boards/espressif32/esp32s3box.html
153-
[env:esp32s3box]
154-
extends = esp32s3
155-
board = esp32s3box
156-
build_flags =
157-
${esp32s3.build_flags}
158-
lib_deps =
159-
${esp32s3.lib_deps}
160-
161-
; pio board config: https://docs.platformio.org/en/latest/boards/espressif32/esp32-s3-devkitc-1.html
162-
[env:esp32-s3-devkitc-1]
163-
extends = esp32s3
164-
board = esp32-s3-devkitc-1
165-
build_flags =
166-
${esp32s3.build_flags}
167-
; PSRAM is optional
168-
lib_deps =
169-
${esp32s3.lib_deps}
170-
171-
; LILYGO: https://www.lilygo.cc/products/t-display-s3
172-
; repository: https://github.com/Xinyuan-LilyGO/T-Display-S3
173-
; pio board config: https://docs.platformio.org/en/latest/boards/espressif32/lilygo-t-display-s3.html
174-
; Buy and support mcuw (affiliate link): https://s.click.aliexpress.com/e/_DE2TNqz
175-
[env:lilygo-t-display-s3]
176-
board = lilygo-t-display-s3
177-
build_flags =
178-
${esp32s3.build_flags}
179-
${extra.build_flags_psram} ; 8MB PSRAM
180-
lib_deps =
181-
${esp32s3.lib_deps}
182-
183-
; LILYGO: https://www.lilygo.cc/products/t-display-s3-long
184-
; repository: https://github.com/Xinyuan-LilyGO/T-Display-S3-Long
185-
; Buy and support mcuw on aliexpress (affiliate link): https://s.click.aliexpress.com/e/_DEv67TX
186-
[env:lilygo-t-display-s3-long]
187-
board = lilygo-t-display-s3-long
188-
board_build.partitions = huge_app.csv
189-
build_flags =
190-
${esp32s3.build_flags}
191-
${extra.build_flags_psram} ; 8MB PSRAM
192-
lib_deps =
193-
${esp32s3.lib_deps}
194-
195-
; SeeedStudio: https://www.seeedstudio.com/WT32-3-5-Inch-Display-p-5542.html
196-
; Antratek: https://www.antratek.com/wt32-sco1-plus
197-
; repository: https://github.com/wireless-tag-com/lv_port_esp32
198-
; ESP32-TUX - github: https://github.com/sukesh-ak/ESP32-TUX
199-
[env:wt32-sc01-plus]
200-
extends = env:esp32-s3-devkitc-1
201-
build_flags =
202-
${env:esp32-s3-devkitc-1.build_flags}
203-
${extra.build_flags_psram} ; 2MB PSRAM

0 commit comments

Comments
 (0)