This code allows you to control an LED matrix via a webserver using a NodeMcu ESP8266. It supports a 15x7 LED matrix consisting of 2 segments. The matrix is controlled using the LEDMatrixDriver.hpp library.
- NodeMcu ESP8266 development board
- 15x7 LED matrix with 2 segments
- Jumper wires
- WiFiClient.h
- LEDMatrixDriver.hpp
- Input your Wi-Fi name and password in the variables
ssid
andpassword
respectively. - The code uses a TCP server on port 80 to respond to HTTP requests. It connects the ESP8266 to your Wi-Fi network using the
WiFiClient.h
library. - An instance of the LEDMatrixDriver class,
lmd
, is defined to control the LED matrix. A block font of size 8x8 is created for displaying characters on the matrix.
- Upload the code to your NodeMcu ESP8266 development board.
- Connect the LED matrix to the appropriate pins on the NodeMcu.
- Power on the NodeMcu.
- Access the IP address of the NodeMcu on your local network using a web browser.
- The server will respond with an HTML page containing a form to input text.
- Enter the desired text in the form and submit it.
- The server will process the request and display the text on the LED matrix.
The following flowchart illustrates the main steps of the code:
graph TD
A(Start) --> B[Initialize WiFi]
B --> C[Create WiFi server]
C --> D[Initialize LED Matrix]
D --> E[Define font]
E --> F[Wait for client connection]
F --> G[Process client request]
G --> H[Check if client is connected]
H -- Yes --> I[Read client request]
H -- No --> F
I --> J[Parse client request]
J --> K[Extract message]
K --> L[Display message on LED Matrix]
L --> M[Close client connection]
M --> F
This code is inspired by the LED matrix examples and utilizes the LEDMatrixDriver.hpp library for controlling the LED matrix.