BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Bring Blynk console to the LCD/TFT/OLED screen


#1

It appears to be very easy to display Blynk logs on the LCD/TFT screen.

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "WROVER_KIT_LCD.h"

WROVER_KIT_LCD screen;

void initConsole()
{
  screen.begin();
  screen.setRotation(1);
  screen.fillScreen(WROVER_BLACK);
  screen.setCursor(0, 0);
  screen.setTextColor(WROVER_WHITE);
  screen.setTextSize(1);
}

/* Here we tell Blynk to output logs to the screen */
#define BLYNK_PRINT screen

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
...

void setup() {
    initConsole();
    ...
}

It just works!

If you’re wondering how, the answer is simple:
Blynk uses .print() and .println() methods of the BLYNK_PRINT object, and the screen library actually provides these functions :wink:


My attempts at transferring BLYNK_PRINT to Various Displays
Turn ESP32 + OLED as a real-time “serial monitor”, Blynk debugging monitor, etc
#2

Nice dev board… $$$… but doesn’t stop me from dreaming :thinking:

And much more functional than the Nokia 5110 LCD I use on my ESP32 :smiley:


#3

It is a full-fledged, high quality dev board, with debugger, lot’s of jumpers, etc :wink:


#4

BTW, if you want to accomplish the same with SSD1306… Crazy idea, but anyway!..
It is a little bit harder as you need to explicitly refresh the screen. I decided to do it once per 100 ms using an ordinary BlynkTimer.

#include "SSD1306.h"
#include "Font.h"

#define OLED_SCL 15
#define OLED_SDA 4
#define OLED_ADDR 0x3C

SSD1306  display(OLED_ADDR, OLED_SDA, OLED_SCL);

#define BLYNK_PRINT display

#include <BlynkSimpleEsp32_SSL.h>

BlynkTimer timer;

void initConsole() {
  pinMode(16,OUTPUT);
  digitalWrite(16, LOW);    // set GPIO16 low to reset OLED
  delay(50);
  digitalWrite(16, HIGH); // while OLED is running, must set GPIO16 in high、

  display.init();
  display.flipScreenVertically();
  display.setTextAlignment(TEXT_ALIGN_LEFT);
  display.setFont(Monospaced_plain_8);
  display.setLogBuffer(6, 30);

  timer.setInterval(100, [](){
    display.clear();
    display.drawLogBuffer(0, 0);
    display.display();
  });
}
...

void setup() {
    initConsole();
    ...
}

void loop()
{
  Blynk.run();
  timer.run();
}

Tested it on TTGO ESP32 LoRa board. Image here:


split this topic #5

2 posts were split to a new topic: My attempts at transferring BLYNK_PRINT to Nokia LCD