Larger font text scrolling across the screen


I’m wondering if someone is able to help me resolve Blynk C coding issue with having text scroll across OLED display. It is possible similar approach can be used for Meshtastic message display on device OLED.

What I have is Wemos D1 mini with 128x64 OLED, push button, and active speaker. I’m using Blynk app to activate buzzer connected to D1 mini, Blynk terminal to send text message to OLED connected to D1 mini, and push button is used to acknowledge message is read on OLED (it drives LED in the Blynk app).

This is what the app looks like:

Everything works well if I don’t invoke scrolling text requirement. Once I put in code to scroll text, I’m having trouble compiling this. I don’t know how to properly declare ‘message’ value coming on virtual pin 1. Can someone please take a look and give me a pointer? I tried asking on Blynk forum but there is no bites.

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define BLYNK_MAX_SENDBYTES 256 // Default is 128
#define message V1

bool mssg;
String message;
int x, minX;

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "my token";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "my SSID";
char pass[] = "my password";

// Attach virtual serial terminal to Virtual Pin V1
WidgetTerminal terminal(V1);

// Select your pin with physical button
const int btnPin = 2;

WidgetLED led1(V2);

BlynkTimer timer;

// V2 LED Widget represents the physical button state
boolean btnState = false;
void buttonLedWidget()
  // Read button
  boolean isPressed = (digitalRead(btnPin) == LOW);

  // If state has changed...
  if (isPressed != btnState) {
    if (isPressed) {
    } else {;
    btnState = isPressed;

    if (String("text") == param.asStr())//Initiate OLED transfer
    terminal.println(F("Enter Message"));
  if(mssg==true&&(String("text") != param.asStr()) )//Prints To OLED
    x=x-2; // scroll speed, make more positive to slow down the scroll
    if(--x < minX) x= display.width();
    //if(--x < minX) x = display.width();

void setup()

  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
    Serial.println(F("SSD1306 allocation failed"));
  //display.startscrollleft(0x00, 0x0F);
  x = display.width();
  minX = -12 * strlen(message);  // 12 = 6 pixels/character * text size 2
  Blynk.begin(auth, ssid, pass);
  // You can also specify server;
  //Blynk.begin(auth, ssid, pass, "", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

  // Clear the terminal content

  // This will print Blynk Software version to the Terminal Widget when
  // your hardware gets connected to Blynk Server
  terminal.println(F("Blynk v" BLYNK_VERSION ": Device started"));
  terminal.println(F("Type your command>"));

    // Setup physical button pin (active low)
  pinMode(btnPin, INPUT_PULLUP);
  timer.setInterval(150L, buttonLedWidget);

void loop()

This is the error I get when compiling:

exit status 1
invalid conversion from 'int' to 'const char*' [-fpermissive]

On this line:

minX = -12 * strlen(message); // 12 = 6 pixels/character * text size 2


I think thats your error. I bet you want:

#define message "V1"

also you should change




Thanks so much for looking at this @geeksville. I fixed those two lines but it still won’t compile, although I think it is something very minor now.

This is the error that is given on line 15 #define message "V1";

exit status 1
expected unqualified-id before string constant

I’m not sure what’s wrong with this as I just did some digging and as I understand it “V1” defines data coming in on V1 as string, so that should be okay.

I commented out line 19 String message; and got it to compile but now whatever text I send to OLED from terminal widget, it just displays V1.

#define message "V1";

You typically don’t want to put semicolons in preprocessor definitions because they are blindly just copied and pasted by the compiler anywhere they are used.

1 Like