Particle.connect(); using Xenon and SEMI_AUTOMATIC returns immediately

My understanding of what is documented for the particle devices, including the Xenon is that in SEMI_AUTOMATIC a connection will not be attempted until Particle.connect(); is called at which point it will block until the connection is made.

Note even the Xenon docs refer to WiFi but I’m guessing this is an editing oversight and they mean BLE instead? Or maybe there is a different Particle.connect() for the BLE Mesh network.

When running this code, the device blinks my test LED so very briefly and then moves right on. No connection is made and the device flashes white slowly.

SYSTEM_MODE(SEMI_AUTOMATIC);

void setup() {

  pinMode(D4, OUTPUT);

  digitalWrite(D4, HIGH);
  Particle.connect();
  digitalWrite(D4, LOW);

}

void loop() {
}

Breathing white means the mesh is not connected. Particle.connect() is only for the cloud connection. It doesn’t control the mesh connection. Call Mesh.connect() instead.

FYI: The mesh does not run on bluetooth or BLE; rather it runs on 802.15.4. The antenna connection is labeled BT because both radios share the antenna.

Ah, Mesh.connect() that is what I was missing. Thanks @ninjatill. So really the Particle.connect() should not even be available on the Xenon.

Particle.connect() is necessary if you need your Xenon to communicate with the cloud directly (through a mesh gateway). If you only need to communicate with the mesh, then it may not be required in your scenario. You could still relay information to the cloud by doing Mesh.publish() on a Xenon and then have your gateway gather that info and calling Particle.publish(). However, without the cloud connected on a Xenon you cannot do OTA firmware updates or any other cloud functionality such as querying a Particle.variable().

Ah interesting. Sooo, the Argon (in my case) needs to be on network via WiFi and then my Xenon that is part of the mesh networks needs to get onto the mesh network first with Mesh.connect() and then do a Particle.connect() after that to get to the cloud. I got into this scenario of doing manually because I am enabling the external antenna on the Xenon which currently has to done in setup. So I want to hold off on attempting connections until the external antenna has been selected, then manually call Mesh.connect() and then Particle.connect()

1 Like

Yep. Sounds like you get it.

1 Like