Getting wrong value with virtualWrite

I’ve install the Blynk client on Raspberry Pi. I am trying to print to a virtual pin a string but I get weird values on the Android app. I attempted to print current time but since this was not possible with value display widget, changed code to integer for testing the basics.

From 0-9, value 511 is displayed. 10-29, 512 is displayed. At 30, values changes to 513. Not sure what’s going on here.

* @file main.cpp
* @author Volodymyr Shymanskyy
* @license This project is released under the MIT License (MIT)
* @copyright Copyright © 2015 Volodymyr Shymanskyy
* @date Mar 2015
* @brief

 #include <time.h>
//#define BLYNK_DEBUG
#define BLYNK_PRINT stdout
 #include <BlynkApiWiringPi.h>
 #include <BlynkApiLinux.h>
#include <BlynkSocket.h>
#include <BlynkOptionsParser.h>

static BlynkTransportSocket _blynkTransport;
BlynkSocket Blynk(_blynkTransport);

#include <BlynkWidgets.h>

  BLYNK_LOG("Got a value: %s", param[0].asStr());

int main(int argc, char* argv[])
    const char *auth, *serv, *port;
    parse_options(argc, argv, auth, serv, port);

    Blynk.begin(auth, serv, port);

    time_t lastTs = 0;
    char buffer[64];
    unsigned int i = 0;
    while(true) {
        time_t t = time(NULL);
        struct tm tm = *localtime(&t);
        if (t - lastTs >= 5) {
            sprintf(buffer, "%d-%d-%d %d:%d:%d", tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900, tm.tm_hour, tm.tm_min, tm.tm_sec);
            lastTs = t;
            int out = rand()%1024;
            sprintf(buffer, "%d", i);
            Blynk.virtualWrite(V0, buffer);

    return 0;


What client do you mean? As I know we don’t have any C client.

I call it Blynk client because it talks to the Blynk server :wink: Maybe your term is Blynk library compiled for RPI. I did it this way:

git clone​ cd blynk-library/linux ​make clean all target=raspberry​ sudo ./blynk --token={your-token}

Maybe @vshymanskyy can help you here as I’m not C guy :slightly_smiling: