LED indicator 2G or 3G

Hi all

I have a problem: I want that a LED is ON as long as 3G is available. If only 2G (fallback) is available the LED should be off. How can I do this? Any ideas?

You’d need to use the respective AT commands via Cellular.command().
To find out which commands are needed for that, you’d need to look in the ublox datasheet.

But IIRC @rickkas7 had something similar in his drawer a while back :wink:

If you use the CellularHelper library (also in the community libraries), this code should work:

#include "Particle.h"

#include "CellularHelper.h"

void setup() {
	pinMode(D7, OUTPUT);


	CellularHelperEnvironmentResponseStatic<1> resp;
	CellularHelper.getEnvironment(CellularHelperClass::ENVIRONMENT_SERVING_CELL, resp);
	if (resp.resp == RESP_OK) {
		if (resp.service.isUMTS) {
			digitalWrite(D7, HIGH);
		else {
	else {
		Serial.printlnf("getEnvironment returned error %d", resp.resp);

void loop() {

You may want to do this every few minutes, in case the Electron is moving around.