How to Show millis data to lcd widget in Blynk exactly showed in serial monitor

this tool calculates the time every two swings past the infrared sensor. like stopwatch that used to count time in simple pendulum experiment,

How do I display the data on the serial monitor to the LCD widget in the latest version of Blynk? already using blynk.virtualWrite but still can’t appear on the LCD widget in blynk

Ayunan means “number of swings”
waktu means “seconds”

such as in this video

here’s the systhematic


here’s the code

#define BLYNK_TEMPLATE_ID "TMPL6LI70RDb"

#define BLYNK_DEVICE_NAME "bandul matematis iot"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#include <ESP8266WiFi.h>

#include <Wire.h>

#include <Adafruit_GFX.h>

#include <Adafruit_SSD1306.h>

#define BLYNK_PRINT Serial // Defines the object that is used for printing

//#define BLYNK_DEBUG        // Optional, this enables more detailed prints

#define APP_DEBUG

#define USE_NODE_MCU_BOARD

#include "BlynkEdgent.h"

// lebar OLED

#define SCREEN_WIDTH 128

// panjang OLED

#define SCREEN_HEIGHT 64

// pin reset

#define OLED_RESET -1

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

double i = 0;

double a = millis();

double c ;

int lap = 0;

//Relay Kontrol Magnet

BLYNK_WRITE(V2){

  if(param.asInt() == HIGH){

    digitalWrite(14, LOW);    

  }

  else{

    digitalWrite(14, HIGH);

  }

}

void setup(){

  Serial.begin(115200);  

  pinMode(12, INPUT);

  digitalWrite(12, HIGH);

  pinMode(14, OUTPUT);

  BlynkEdgent.begin();

}

void loop(){

  delay(10);

  if(digitalRead(12) == LOW)

   {

   c = millis();

   i = (c - a) / 1000;

   if(i > 1)

    {

      lap++;

      Serial.print("Lap: ");

      Serial.print(lap);

      Serial.print("\t\t");

      Serial.println(i);

      a = millis();

    }

  }

  BlynkEdgent.run();

  Blynk.virtualWrite(V3, i);

  Blynk.virtualWrite(V1, lap);

}

@andikarifqi Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Copy and paste these if you can’t find the correct symbol on your keyboard.

Pete.

thanks for the correction, since i’m beginnner using this platform

You’ve edited your post and used Blockquotes on your code instead of doing what I asked.

Please edit your post as I asked otherwise your unformatted code will be removed.

Pete.

Okay, first of all, you shouldn’t run this sketch on your device, as it breaks the golden role of Blynk, which is never to have Blynk.virtualWrite commands in your void loop.

You should read this article…

https://docs.blynk.io/en/legacy-platform/legacy-articles/keep-your-void-loop-clean

Note that in your case Blynk.run() won’t be used as its BlynkEdgent.run() that’s being used instead.

Secondly, your video says…

I’d suggest that you provide some clues about which virtual datastream your Blynk LCD widget is attached to, what data type you’ve chosen for that datastream, how you’ve configured that widget in your mobile dashboard, and whether you are using the iOS or Android version of the app.

Pete.

i want to send lap to V3 and i to V1

#define BLYNK_TEMPLATE_ID "TMPL6LI70RDb"

#define BLYNK_DEVICE_NAME "bandul matematis iot"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#include <ESP8266WiFi.h>

#include <Wire.h>

#include <Adafruit_GFX.h>

#include <Adafruit_SSD1306.h>

#define BLYNK_PRINT Serial // Defines the object that is used for printing

//#define BLYNK_DEBUG        // Optional, this enables more detailed prints

#define APP_DEBUG

#define USE_NODE_MCU_BOARD

#include "BlynkEdgent.h"

double i = 0;

double a = millis();

double c ;

int lap = 0;

BlynkTimer timer; // Announcing the timer

void sensorDataSend()
{
  delay(10);

  if(digitalRead(12) == LOW)

   {

   c = millis();

   i = (c - a) / 1000;

   if(i > 1)

    {

      lap++;

      Serial.print("Lap: ");

      Serial.print(lap);

      Serial.print("\t\t");

      Serial.println(i);

      a = millis();

    }
Blynk.virtualWrite(V1, i);
}

void setup(){

  Serial.begin(115200);  

  pinMode(12, INPUT);

  digitalWrite(12, HIGH);

  pinMode(14, OUTPUT);

  BlynkEdgent.begin();
  timer.setInterval(500L, sensorDataSend); //timer will run every sec

}

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

well, it only getting worse and worse. pardon me :sweat_smile:

Pete.

i’m using blynk android version. the first line of LCD widget (ayunan) is attach to Virtual datastream 3, and the second line of LCD widget (waktu) is attach to Virtual datastrean1

You keep feeding partial answers through one piece at a time, as though the information is top secret. I’m not going to keep asking for the information over and over again, as I clearly don’t have a high enough security clearance for this information :roll_eyes:

Good luck with your project.

Pete.

i’m sorry im keep repeat the answer. (even tough i’ve share all the information as far as i know).I apologize for not being able to explain and provide understanding information about this project. Honestly, I myself am very confused how to convey all about my first project. thanks for the directions and sorry for my misunderstanding to have confused you.

datatype that i use for the datastream is
1.double
2. integer