I’ve been trying to use the bridge widget between two devices without much luck. I’ve reviewed all the community posts and the documentation on using a bridge. Setup is pretty simple. Sender is a particle photon and the receiver is a adafruit huzzah.
Both have a terminal widget and I can see in the app that the loops are running.
I’ve had no luck getting any communication from the sender to yield a result on the receiver. I’ve tried using digital, analog, and virtual.
In the app I am able to add a button connected to the receiver digital pin 0 and make the led flash. This also lets me know that pin 0 works from the app and should yield a result if called via a bridge.
Any thoughts on what I’m doing wrong?
Thanks!
Code for particle photon (sender)
// #define BLYNK_DEBUG // Optional, this enables lots of prints
#define BLYNK_PRINT Serial
#include "blynk/blynk.h"
#include "SparkCorePolledTimer/SparkCorePolledTimer.h"
char auth[] = "provided";
WidgetTerminal terminal(V0);
// Bridge widget on virtual pin 1
WidgetBridge bridge1(V1);
SparkCorePolledTimer updateTimer(5000);
void setup()
{
Serial.begin(115200);
Blynk.begin(auth);
while (Blynk.connect()) {
bridge1.setAuthToken("provided from adafruit huzzah");
}
updateTimer.SetCallback(OnTimer);
}
void loop()
{
Blynk.run();
updateTimer.Update();
}
void OnTimer(void) {
terminal.println(millis() / 1000);
Serial.println(millis() / 1000);
terminal.flush();
bridge1.digitalWrite(0, HIGH);
delay(2000);
bridge1.digitalWrite(0, LOW);
delay(2000);
bridge1.virtualWrite(2, millis() / 1000);
}
Code for adafruit huzzah (receiver)
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
char auth[] = "provided";
WidgetTerminal terminal(V0);
SimpleTimer timer;
void sendUptime()
{
terminal.println("- - huzzah - -");
terminal.println(millis() / 1000);
terminal.flush();
}
BLYNK_WRITE(V2) {
terminal.println("- - photon - -");
terminal.println(param.asStr());
terminal.flush();
}
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, "ssid", "code");
timer.setInterval(5000L, sendUptime);
}
void loop()
{
Blynk.run();
timer.run(); // Initiates SimpleTimer
}
Here is what the app looks like. Unsure if the bridge widget is needed. You’ll notice that there is no - - photon- - output.