Devices & Components
ESP32 WROOM
8x32 WS2812b Matrix
Software & Tools
Arduino IDE
Project description
Code
BT_Text
arduino
Use the Arduino IDE to compile and send to the ESP32
1#include <Adafruit_GFX.h> 2#include <Adafruit_NeoMatrix.h> 3#include <Adafruit_NeoPixel.h> 4#include <BluetoothSerial.h> // Available here : https://github.com/espressif/arduino-esp32/tree/master/libraries/BluetoothSerial 5 6BluetoothSerial BT_Text; 7 8#define PIN 25 // This is the led signal pin 9 10Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32, 8, PIN, 11 NEO_MATRIX_TOP + NEO_MATRIX_LEFT + 12 NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG, 13 NEO_GRB + NEO_KHZ800); 14 15int i; 16String Text; 17int x = matrix.width(); 18int Size; 19 20const uint16_t colors[] = { 21 matrix.Color(204, 0, 204), matrix.Color(204, 204, 0), matrix.Color(0, 255, 255), 22 matrix.Color(255, 10, 127), matrix.Color(127, 0, 255), matrix.Color(0, 255, 0), 23 matrix.Color(255, 99, 255), matrix.Color(204,177,0), matrix.Color(0,0,244) }; // Colour presets 24 25void PrintOut() { 26 while (!BT_Text.available()) { 27 } 28 while (BT_Text.available()) { 29 i = BT_Text.read(); 30 Text = Text + char (i); 31 } 32} 33 34 35 36 37void setup() { 38 // Serial.begin(115200); 39 BT_Text.begin("BT_Text"); //Name of the Bluetooth interface (On your phone) 40 matrix.begin(); 41 matrix.setTextWrap(false); 42 matrix.setBrightness(40); 43 matrix.setTextColor(colors[0]); 44 Text = "*MERRY CHRISTMAS*"; 45 Size = Text.length()*6; 46} 47 48 49 50void loop() { 51 if (BT_Text.available()) { 52 i = BT_Text.read(); 53 if (i < 9) { 54 matrix.setTextColor(colors[i]); 55 } 56 else { 57 Text = ""; 58 PrintOut(); 59 Size = Text.length()*6; 60 } 61 } 62 matrix.fillScreen(0); //Turn off all the LEDs 63 matrix.setCursor(x, 0); 64 matrix.print(Text); 65 if ( --x < -Size) { 66 x = matrix.width(); 67 } 68 matrix.show(); 69 delay(50); 70} 71
Downloadable files
Wiring
The signal pin i used is GPIO 25
Wiring
Documentation
Mobile Phone app
Download this and install it on your Android phone
Mobile Phone app
Comments
Only logged in users can leave comments