[SOLVED] Read Step/Slider Widget during Setup

I would like to read the value of the Step Widget at the start without having to physically step the widget on my phone.

Example:

If my Step Widget is set at say 20, now if my ESP8266 has a cold power start I want it to automatically read the value “20” This would apply to a Slider Widget as well

How would I implement the code?

Thanks

int someValue;
BLYNK_WRITE(V0) 
{
   someValue = param.asInt();
} 

And in setup add
Blynk.syncVirtual(V0);

Edit virtual pin for your setup

1 Like

Thanks so much, that worked.

I’m interested in doing the same thing, but this didn’t work for me. Everything runs well and outputs to Serial when I step V3 and V5. But when I hit the “start” button on pin V6, I want it to already have the values from V3 and V5.

#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial

// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX

#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleSerialBLE.h>

char auth[] = "...";

int travelTime;
int motorSpeed;

BLYNK_WRITE(V3)
{
  travelTime = param.asInt(); // assigning incoming value from pin V1 to a variable
  // You can also use:
  // String i = param.asStr();
  // double d = param.asDouble();
  Serial.print("Travel Time: ");
  Serial.println(travelTime);
}

BLYNK_WRITE(V5)
{
  motorSpeed = param.asInt(); // assigning incoming value from pin V1 to a variable
  // You can also use:
  // String i = param.asStr();
  // double d = param.asDouble();
  Serial.print("Motor Speed: ");
  Serial.println(motorSpeed);
}

BLYNK_WRITE(V6)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
  // You can also use:
  // String i = param.asStr();
  // double d = param.asDouble();
  Serial.print("START!      ");
  Serial.print("     Travel Time: ");
  Serial.print(travelTime);
  Serial.print("     Motor Speed: ");
  Serial.println(motorSpeed);
}

void setup() {
    Serial.begin(9600);
    Blynk.begin(Serial, auth);

    Blynk.syncVirtual(V3);
    Blynk.syncVirtual(V5);           
}

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

@ChrisPomerleau You should really start your own topic instead of a “Me Too” addon. Your situation could be completely different… as in… aren’t you running via Bluetooth? because Blynk.syncVirtual(Vx);requires a server connection.