Seria exatamente assim
Porém com a função de mudar o placar manualmente com push botão
Link do vídeo
Código
/*
Tutorial: IoT scoreboard using Teensy and ESP8266 with Blynk app
Hardware:
External libraries:
- Blynk by Volodymyr Shymanskyy Version 0.6.1
- Adafruit GFX Library by Adafruit Version 1.7.5
- Adafruit NeoPixel by Adafruit Version 1.3.4
- Adafruit NeoMatrix by Adafruit Version 1.1.4
Created by:
2 Mar 2020 Idris Zainal Abidin, Cytron Technologies
*/
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
char auth[] = "YourAuthToken";
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
#define EspSerial Serial3
#define ESP8266_BAUD 115200
ESP8266 wifi(&EspSerial);
#define PIN 1
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32, 8, PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,
NEO_GRB + NEO_KHZ800);
const uint16_t colors[] = {
matrix.Color(255, 255, 255), // White
matrix.Color(255, 0, 0), // Red
matrix.Color(0, 0, 255) // Blue
};
enum {WHITE, RED, BLUE};
int x = matrix.width();
int score1 = 0;
int score2 = 0;
boolean scoreUpdate = true;
BLYNK_WRITE(V0)
{
score1 = param.asInt();
scoreUpdate = true;
}
BLYNK_WRITE(V1)
{
score2 = param.asInt();
scoreUpdate = true;
}
BLYNK_WRITE(V2)
{
if (param.asInt()) {
score1 = 0;
Blynk.virtualWrite(0, 0);
scoreUpdate = true;
}
}
BLYNK_WRITE(V3)
{
if (param.asInt()) {
score2 = 0;
Blynk.virtualWrite(1, 0);
scoreUpdate = true;
}
}
void setup()
{
Serial.begin(9600);
delay(10);
EspSerial.begin(ESP8266_BAUD);
delay(10);
matrix.begin();
matrix.setTextWrap(false);
matrix.setBrightness(60);
matrix.setTextColor(colors[WHITE]);
matrix.setCursor(7, 0);
matrix.print(F("..."));
matrix.show();
Blynk.begin(auth, wifi, ssid, pass);
// Scrolling display "Ready"
while (1) {
matrix.fillScreen(0);
matrix.setCursor(x, 0);
matrix.print(F("Ready"));
if (--x < -30) {
break;
}
matrix.show();
delay(100);
}
}
void loop()
{
Blynk.run();
if (scoreUpdate == true) {
scoreUpdate = false;
matrix.fillScreen(0);
matrix.setTextColor(colors[RED]);
matrix.setCursor(0, 0);
matrix.print(score1);
matrix.setTextColor(colors[WHITE]);
matrix.setCursor(13, 0);
matrix.print(F("-"));
matrix.setTextColor(colors[BLUE]);
if (score2 < 10) {
matrix.setCursor(26, 0);
}
else {
matrix.setCursor(20, 0);
}
matrix.print(score2);
matrix.show();
}
}