How to create a Xenon only mesh (unfortunately the caveat is an Argon or Boron is required to set it up)
Items needed
1) Argon or Boron(not tested)
2) Two Xenons
CAUTION Once you program your Xenons with the following code you won’t be able to OTA flash without putting them in safe mode. I don’t recommend doing this if you don’t know what OTA means or have never worked with Particle devices before. You won’t hurt your devices but you might find yourself confused, lost, or frustrated, and that is not what we want to do here.
That being said here goes…
Setup a network of the three devices, as a starting point probably running Tinker is best.
Once you have all three breathing cyan do the following
Flash one of your Xenons with this code
SYSTEM_MODE(MANUAL);
bool beat = FALSE;
unsigned long beatTimer = millis();
char pub[10];
void setup() {
Mesh.connect();
while(!Mesh.ready()) {
}
pinMode(D7, OUTPUT);
}
void loop() {
if (millis() - beatTimer >= 1000) {
beatTimer = millis();
beat = !beat;
digitalWrite(D7, beat);
snprintf(pub, sizeof(pub), "%d\n", beat);
Mesh.publish("Heartbeat", pub);
}
}
When it restarts it will breath green, that’s correct, breathing green, it is not connected to the particle cloud. It will also be flashing it’s blue LED.
Flash the second Xenon with this code
SYSTEM_MODE(MANUAL);
bool beat = FALSE;
void myHandler(const char *event, const char *data)
{
beat = atoi(data);
digitalWrite(D7, beat);
}
void setup() {
Mesh.connect();
while (!Mesh.ready()) {
}
pinMode(D7, OUTPUT);
Mesh.subscribe("Heartbeat", myHandler);
}
void loop() {
}
When this Xenon restarts it will also be breathing green and flashing it’s blue LED because it is listening to the published event of the first Xenon
When you have this working, pull the power from the Argon or Boron(not tested).
The Xenons however are still flashing their blue LED.
This is where the BUG shows up. After roughly 5 minutes both Xenons start to rapidly flash their green LEDs as if trying to connect to the Particle Cloud. They have not been told to do so by Particle.connect().
However the mesh network continues to function as the blue LEDs continue flashing.
What happens if you unplug one of the Xenons and plug it back in? The mesh reconnects and the blue LEDs start to flash again. Take your Xenons to another room and plug them in and boom, they reconnect and start flashing the blue LED.
If you can live with the rapid flashing green for now until we get newer firmware then you have yourself a Xenon only network.
I have tried a call to Particle.disconnect() in the publishing loop but it has no effect on the flashing green.
To change the firmware on these you need to plug the Argon or Boron back in and put the Xenon in safe mode to OTA flash.
Enjoy!