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
7 Likes
Gunner
January 27, 2018, 2:08pm
2
Nice dev board⌠$$$⌠but doesnât stop me from dreaming
And much more functional than the Nokia 5110 LCD I use on my ESP32
1 Like
It is a full-fledged, high quality dev board, with debugger, lotâs of jumpers, etc
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:
Gunner
Split this topic
January 30, 2018, 2:18am
5