[Solved] Help with test bridge project

Hi all,

I would appreciate any help.
I am trying to make 2 nodemcu talk via bridge widget…

Sender code:

#include "SimpleTimer.h"
#include <BlynkSimpleEsp8266.h>
#include <WidgetRTC.h>


const char* auth     = "........800d74a42";
const char* ssid     = "AnxxxDSL";
const char* password = "xxxx";

SimpleTimer     MyTimer;
int             MyId;
WidgetBridge bridge(V0);



BLYNK_CONNECTED()
{
  bridge.setAuthToken(".......66a45f"); 
}


void MyProc()
{
  unsigned long time;
  time = millis();
  Blynk.virtualWrite(V1, time);
  Serial.print("Sending: ");
  Serial.println(time);
}


void setup()
{
  Serial.begin(256000);
  Serial.println();
  Serial.println();

  MyId = MyTimer.setInterval(5000L, MyProc);
  Blynk.begin(auth, ssid, password);
  while (Blynk.connect() == false) {}
  Serial.println("Connected");
}


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

Reciever code:

#include "SimpleTimer.h"
#include <BlynkSimpleEsp8266.h>
#include <WidgetRTC.h>


const char* auth     = "........66a45f";
const char* ssid     = "xxxxxSL";
const char* password = "xxxxx";
bool        isFirstConnect = true;



//==================================================================================
//==================================================================================

BLYNK_CONNECTED()
{
  if (isFirstConnect)
  {
    Blynk.syncAll();
    isFirstConnect = false;
  }
}

//==================================================================================
//==================================================================================


BLYNK_WRITE(V1)
{
  int value = param.asInt();
  Serial.println("Got Value:");
  Serial.println(String(value, 1));
}

//==================================================================================
//==================================================================================

void setup()
{
  Serial.begin(256000);

  Serial.println();
  Serial.println();
  Serial.println("Starting");

  Blynk.begin(auth, ssid, password);
  while (Blynk.connect() == false) {}
  Serial.println("Connected");
}


//==================================================================================
//==================================================================================


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

Thank you

ok, and what is the question / problem?
what is happening and what do you expect to happen?

I cant get the “receiver” to get value from the sender…

are these prints appear every 5 second in sender serial monitor?

As far as I can see, you are not actually sending any info over your bridge… you need something like this:

bridge.virtualWrite(vPin, value);
1 Like

nah, nice catch!
it means time to go to sleep for me :wink:

Thank you:slight_smile:
Will try that…

Thank you guys.

That was it.

For future Reference:

Sender:

#include "SimpleTimer.h"
#include <BlynkSimpleEsp8266.h>
#include <WidgetRTC.h>


const char* auth     = "......00d74a42";
const char* ssid     = "xxx";
const char* password = "xxx";

SimpleTimer     MyTimer;
int             MyId;
WidgetBridge bridge(V0);



BLYNK_CONNECTED()
{
  bridge.setAuthToken("......dd66a45f"); 
}


void MyProc()
{
  unsigned long time;
  time = millis();
  bridge.virtualWrite(V1, time);    //  <<<<<<<<<<<<<< Here was my Mistake!!!
  Serial.print("Sending: ");
  Serial.println(time);
}


void setup()
{
  Serial.begin(256000);
  Serial.println();
  Serial.println();

  MyId = MyTimer.setInterval(5000L, MyProc);
  Blynk.begin(auth, ssid, password);
  while (Blynk.connect() == false) {}
  Serial.println("Connected");
}


void loop() {
  Blynk.run();
  MyTimer.run();
}
1 Like