Initial commit for dht11-lcd example.
This commit is contained in:
18
esp/cpp/08_dht11-lcd/CMakeLists.txt
Normal file
18
esp/cpp/08_dht11-lcd/CMakeLists.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
# For more information about build system see
|
||||
# https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html
|
||||
# The following five lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
project(
|
||||
#[[NAME]] aht20
|
||||
VERSION 0.1
|
||||
DESCRIPTION "Using the AHT20 sensor with ESP-IDF over I2C"
|
||||
LANGUAGES CXX
|
||||
)
|
||||
message(STATUS "[Klips] Configuring example: ${PROJECT_NAME}")
|
||||
# For writing pure cmake components, see the documentation
|
||||
# https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/build-system.html#writing-pure-cmake-components
|
||||
idf_build_set_property(COMPILE_OPTIONS "-Wno-error" APPEND)
|
||||
27
esp/cpp/08_dht11-lcd/README.md
Normal file
27
esp/cpp/08_dht11-lcd/README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# 08_dht11-lcd
|
||||
|
||||
Using the ESP IDF for reading data from a DHT11 sensor and displaying it on an LCD.
|
||||
|
||||
[ESP IDF - I2C](https://docs.espressif.com/projects/esp-idf/en/v5.3.2/esp32/api-reference/peripherals/i2c.html)
|
||||
|
||||
[ESP IDF - LCD](https://docs.espressif.com/projects/esp-idf/en/v5.3.2/esp32/api-reference/peripherals/lcd/index.html)
|
||||
|
||||
[ESP IDF - FreeRTOS](https://docs.espressif.com/projects/esp-idf/en/v5.3.2/esp32/api-reference/system/freertos.html)
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
For instructions on setting up the ESP-IDF see [04_-esp-idf-arduino](./../04_esp-idf-arduino)
|
||||
|
||||
To build this example run the following commands.
|
||||
|
||||
```bash
|
||||
source ~/path/to/esp-idf/export.sh
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make -j $(nproc)
|
||||
make flash
|
||||
```
|
||||
BIN
esp/cpp/08_dht11-lcd/example.gif
Normal file
BIN
esp/cpp/08_dht11-lcd/example.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 887 KiB |
7
esp/cpp/08_dht11-lcd/main/CMakeLists.txt
Normal file
7
esp/cpp/08_dht11-lcd/main/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
idf_component_register(
|
||||
SRCS
|
||||
main.cpp
|
||||
main.h i2c.h
|
||||
INCLUDE_DIRS .
|
||||
REQUIRES driver
|
||||
)
|
||||
3
esp/cpp/08_dht11-lcd/main/idf_component.yml
Normal file
3
esp/cpp/08_dht11-lcd/main/idf_component.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
## IDF Component Manager Manifest File
|
||||
dependencies:
|
||||
idf: '>=5.3.0'
|
||||
22
esp/cpp/08_dht11-lcd/main/main.cpp
Normal file
22
esp/cpp/08_dht11-lcd/main/main.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2025 Shaun Reed, all rights reserved ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
|
||||
##############################################################################
|
||||
*/
|
||||
|
||||
#include "i2c.h"
|
||||
|
||||
// Pin may vary based on your schematic.
|
||||
#define PIN_SDA GPIO_NUM_21
|
||||
#define PIN_SCL GPIO_NUM_22
|
||||
#define PIN_RST (-1)
|
||||
|
||||
I2C i2c(PIN_SDA, PIN_SCL, PIN_RST);
|
||||
|
||||
extern "C" void app_main(void)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
39
esp/cpp/08_dht11-lcd/main/main.h
Normal file
39
esp/cpp/08_dht11-lcd/main/main.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*#############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2025 Shaun Reed, all rights reserved ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
|
||||
##############################################################################
|
||||
*/
|
||||
#include "display.h"
|
||||
#include "ssd1306.h"
|
||||
|
||||
// Pin may vary based on your schematic.
|
||||
#define PIN_SDA GPIO_NUM_21
|
||||
#define PIN_SCL GPIO_NUM_22
|
||||
#define PIN_RST (-1)
|
||||
|
||||
I2C i2c(PIN_SDA, PIN_SCL, PIN_RST);
|
||||
|
||||
extern "C" void app_main(void)
|
||||
{
|
||||
SSD1306 ssd1306(i2c);
|
||||
Display d(ssd1306);
|
||||
|
||||
d.set_text("Test test 12345678910",
|
||||
"test-text1",
|
||||
LV_LABEL_LONG_SCROLL,
|
||||
LV_ALIGN_CENTER);
|
||||
|
||||
d.set_text("Test test changing text",
|
||||
"test-text1",
|
||||
LV_LABEL_LONG_SCROLL,
|
||||
LV_ALIGN_CENTER);
|
||||
|
||||
d.set_text("Hello hello hello hello hello hello hello hello!", "test-text2");
|
||||
|
||||
d.set_text("A random sentence with no meaning at all.",
|
||||
"test-text3",
|
||||
LV_LABEL_LONG_CLIP,
|
||||
LV_ALIGN_BOTTOM_MID);
|
||||
}
|
||||
BIN
esp/cpp/08_dht11-lcd/schematic.png
Normal file
BIN
esp/cpp/08_dht11-lcd/schematic.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 227 KiB |
2240
esp/cpp/08_dht11-lcd/sdkconfig
Normal file
2240
esp/cpp/08_dht11-lcd/sdkconfig
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user