Get Off Of My Cloud error (Breathing Green Photon)

Hi, tried searching the forum but couldn’t find much about this.
I’ve used the Core for a while but am having issues with the Photon. I’ve wired up an RFID to it ( the MFRC522 ) and connected it as advised. Have connected it to the net successfully and flashed it with the following:

// This #include statement was automatically added by the Particle IDE.
#include "MFRC522/MFRC522.h"
#define SS_PIN      A2
#define RST_PIN     D2
MFRC522 mfrc522(SS_PIN, RST_PIN);

void loop() {
   
    // Look for new cards
    if ( ! mfrc522.PICC_IsNewCardPresent()) {
    	return;

    }

    // Select one of the cards
    if ( ! mfrc522.PICC_ReadCardSerial()) {
    	return;
    	
    }

    String cardID = "";
    
    for (byte i = 0; i < mfrc522.uid.size; i++) 
    
    {
        cardID += String(mfrc522.uid.uidByte[i] < 0x10 ? "0" : "");
        cardID += String(mfrc522.uid.uidByte[i], HEX);
        
    }

    Serial.println(cardID);

    Particle.publish("pushover", cardID + " scanned");

    mfrc522.PICC_HaltA();
}

The result connects to the net and breathes cyan for a couple of breaths… then breathes nothing but green.
How come it can;t connect to the cloud? it’s going via my phone which has internet, and AFAIK my network cant tell I’m tethering to restrict it (giffgaff - android, worked fine with the photon to flash it). Any help would be much appreciated! I can reflash it but it seems to be the above code causing this, never used an external Lib before on Photon, anyone have any tips?

Try commenting out this line. It’s publishing continuously to the :cloud: and should be causing issues.

1 Like

Hi @kennethlimcp ,
It should only publish if theres a card on the reader I’d thought…?
But thanks for the feedback it probably is swamping the cloud. I’ll make it a bit more sophisticated and check the length of cardID and whether it’s the same as it was the previous frame etc, and add a delay. Cheers for the quick reply!

Seems not to be this causing the problems, even when I comment this out it still happens. :S
Looks like there might be an error in the mfrc522 lib or something but I cant see quite why it would be stopping the connection to the cloud. Does anyone else have any ideas please?

If the lib (or any other part of the code) blocks for more than 10sec the cloud connection will be dropped.
To maintain connection you need to drop out of loop() or call Particle.process() at least once per 10sec.

1 Like

Great tip Scruff, thanks… it’s probably what’s happening.

1 Like