Particle is not publish

I adapt “wake on move” by including GPS and reduce state. But when I taste it, nothing publish. I can see nothing appear on thing speak even particle log.
Here is a part of it.

	case SLEEP_STATE:
	     
	     Particle.disconnect();
	     delay(500);
	     
	      if(t.readXYZmagnitude() >= accelThreshold ){
	          
	         Particle.connect();  
	         delay(500); 
             awake = ((t.clearAccelInterrupt() & LIS3DH_INT1_SRC_IA) != 0);
         
             Serial.println(t.readXYZmagnitude());
             t.updateGPS();
             state = PUBLISH_STATE; 
         }
	     
	     else{
	         state = SLEEP_WAIT_STATE;
	     }
	break;

I use particle.disconnect instead of sleep mode because it not wake unless I press reset button.

In the code above, you’re merely printing over serial. Nothing is/should be getting to the web with that code.

Here is my publish state

case PUBLISH_STATE:
        if (Particle.connected()) {
			// The publish data contains 3 comma-separated values:
			// whether movement was detected (1) or not (0) The not detected publish is used for battery status updates
			// cell voltage (decimal)
			// state of charge (decimal)
			
			delay(10000);
			 
			float lat = t.readLatDeg();
			float lon = t.readLonDeg();
			

			
			char data[32];
			float cellVoltage = batteryMonitor.getVCell();
			float stateOfCharge = batteryMonitor.getSoC();
			snprintf(data, sizeof(data), "%d,%.02f,%.02f", awake, cellVoltage, stateOfCharge);
            
            String pubGPS   = String::format("%f,%f",lat,lon);
        //  String pubAccel = String::format("%d,%d,%d",t.readX(),t.readY(),t.readZ());
		    Serial.println(t.readXYZmagnitude());
		
			Particle.publish(eventName, data, 60, PRIVATE);

		//	Particle.publish("Accelerometer_wake",pubAccel, PRIVATE);
			
			
			while(lat == 0.0){
			   delay(10000);
			}
			   
		    Particle.publish("GPS_wake",pubGPS, PRIVATE);
		    delay(5000);
		    stateTime = millis();
		    state = SLEEP_WAIT_STATE;

		}
		
		else {
			// Haven't come online yet, let it oniline
			Particle.connected();
			state = PUBLISH_STATE; 
        }
			
	break;

Try inserting some serial prints and see how far the code makes it.

Thank you :slight_smile: