You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.5 KiB
2.5 KiB
title | description | date | tags | categories | author | license |
---|---|---|---|---|---|---|
ESP32 PlatformIO | Microcontroller development project setup / template | 2020-05-03 | [esp32 project platformio microcontroller programming] | [tutorial] | hendrik | WTFPL |
Install PlatformIO
apt install platformio
platformio platform update
Project setup
Choose your development board from the list. You can see all supported boards with the command: platformio boards espressif32
Now create your new project:
cd ~/Projects/esp32/
mkdir new_project
cd new_project
platformio project init --board esp-wrover-kit
Configuration
platformio.ini:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[env:esp-wrover-kit]
platform = espressif32
board = esp-wrover-kit
framework = arduino
monitor_speed = 115200
#build_flags =
# -DBOARD_HAS_PSRAM
# -mfix-esp32-psram-cache-issue
# -DCONFIG_SPIRAM_CACHE_WORKAROUND
# -DCORE_DEBUG_LEVEL=5
#
#board_build.partitions = huge_app.csv
#
#lib_deps =
# TFT_eSPI
Code
src/main.cpp:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* Blink
*
* Turns on an LED on for one second,
* then off for one second, repeatedly.
*/
#include "Arduino.h"
#ifndef LED_BUILTIN
#define LED_BUILTIN 13
#endif
void setup()
{
// initialize LED digital pin as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
// turn the LED on (HIGH is the voltage level)
digitalWrite(LED_BUILTIN, HIGH);
// wait for a second
delay(1000);
// turn the LED off by making the voltage LOW
digitalWrite(LED_BUILTIN, LOW);
// wait for a second
delay(1000);
}
now compile and upload your program
platformio run
platformio run --target upload
platformio device monitor
SPIFFS
create folder data/
platformio run --target uploadfs
Git
.gitignore:
.pio
and push to your project on github or gitlab:
touch README.md
git init
git commit -m "first commit"
git remote add origin https://gitlab.com/username/new_project.git
git push -u origin master
License
LICENSE:
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified copies of
this license document, and changing it is allowed as long as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.