I am currently working in led matrix 32x8 and using blynk as controller. I have a problem in displaying text in my matrix led from the input in the terminal of blynk. Everytime I type and send a message from terminal, it only appears in serial monitor and didn’t display in led martix. The matrix only change the display if I only type in the serial monitor and not in terminal.
CODE:
#define BLYNK_PRINT Serial
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define BLYNK_TEMPLATE_ID "TMPLgmba-Rsg"
#define BLYNK_DEVICE_NAME "LED"
#define BLYNK_AUTH_TOKEN "BSG02j76Sp55Wa47tg68AnJ2DeMb8zFX" //Enter your blynk auth token
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "HUAWEI-C38E";//Enter your WIFI name
char pass[] = "72261758";//Enter your WIFI password
// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN D13
#define DATA_PIN D11
#define CS_PIN D10
WidgetTerminal terminal(V3);
BLYNK_WRITE(V3){
String textIn = param.asStr();
Serial.print(textIn + "\n");
}
// HARDWARE SPI
MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
uint8_t scrollSpeed = 25; // default frame delay value
textEffect_t scrollEffect = PA_SCROLL_LEFT;
textPosition_t scrollAlign = PA_LEFT;
uint16_t scrollPause = 2000; // in milliseconds
// Global message buffers shared by Serial and Scrolling functions
#define BUF_SIZE 75
char curMessage[BUF_SIZE] = { "" };
char newMessage[BUF_SIZE] = { "Hello! Enter new message?" };
bool newMessageAvailable = true;
void readSerial(void)
{
static char *cp = newMessage;
while (Serial.available())
{
*cp = (char)Blynk.virtualWrite(V3, textIn);
if ((*cp == '\n') || (cp - newMessage >= BUF_SIZE-2)) // end of message character or full buffer
{
*cp = '\0'; // end the string
// restart the index for next filling spree and flag we have a message waiting
cp = newMessage;
newMessageAvailable = true;
}
else // move char pointer to next position
cp++;
}
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
P.begin();
P.displayText(curMessage, scrollAlign, scrollSpeed, scrollPause, scrollEffect, scrollEffect);
}
void loop()
{
Blynk.run();
if (P.displayAnimate())
{
if (newMessageAvailable)
{
strcpy(curMessage, newMessage);
newMessageAvailable = false;
}
P.displayReset();
}
readSerial();
}
```
I HOPE SOMEONE CAN HELP ME! THANK YOU!