diff --git a/content/snippets/esp32/platformio/esp-lora-board.jpg b/content/snippets/esp32/platformio/esp-lora-board.jpg new file mode 100644 index 0000000..9f11a99 Binary files /dev/null and b/content/snippets/esp32/platformio/esp-lora-board.jpg differ diff --git a/content/snippets/esp32/platformio/index.de.md b/content/snippets/esp32/platformio/index.de.md new file mode 120000 index 0000000..417369a --- /dev/null +++ b/content/snippets/esp32/platformio/index.de.md @@ -0,0 +1 @@ +index.en.md \ No newline at end of file diff --git a/content/snippets/esp32/platformio/index.en.md b/content/snippets/esp32/platformio/index.en.md new file mode 100644 index 0000000..ceb0f10 --- /dev/null +++ b/content/snippets/esp32/platformio/index.en.md @@ -0,0 +1,143 @@ +--- +title: ESP32 PlatformIO +description: Microcontroller development project setup / template +date: 2020-05-03 +tags: ["esp32", "project", "platformio", "microcontroller", "programming"] +categories: ["tutorial"] +author: hendrik +license: WTFPL +--- + +![ESP32 Lora Board](esp-lora-board.jpg) + +## Install PlatformIO + +```shell +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: + +```shell +cd ~/Projects/esp32/ +mkdir new_project +cd new_project +platformio project init --board esp-wrover-kit +``` + +## Configuration + +#### platformio.ini: +```ini +[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: +```c++ +/** + * 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 + +```shell +platformio run +platformio run --target upload +platformio device monitor +``` + +## SPIFFS +create folder `data/` + +```shell +platformio run --target uploadfs +``` + +## Git + +#### .gitignore: +``` +.pio +``` + +and push to your project on github or gitlab: + +```shell +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 + +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. +``` diff --git a/content/snippets/platformio.de.md b/content/snippets/platformio.de.md deleted file mode 120000 index 2a69aee..0000000 --- a/content/snippets/platformio.de.md +++ /dev/null @@ -1 +0,0 @@ -platformio.en.md \ No newline at end of file diff --git a/content/snippets/platformio.en.md b/content/snippets/platformio.en.md deleted file mode 100644 index 5bb3f83..0000000 --- a/content/snippets/platformio.en.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: ESP32 PlatformIO -description: ESP32 project setup -date: 2020-04-23 -tags: ["esp32", "project"] -categories: ["tutorial"] -author: hendrik -draft: true ---- - -## 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: -``` -[env:esp-wrover-kit] -platform = espressif32 -board = esp-wrover-kit -framework = arduino -monitor_speed = 115200 -``` - -create the main: - -src/main.cpp: -``` -/** - * 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 - -## Git -git init