Author Topic: Red LED blinks without reference in code  (Read 240 times)

millennial

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Red LED blinks without reference in code
« on: July 11, 2016, 11:02:27 am »
Battery low does not do this. A reboot takes at least 5 seconds because that is the time the bootloader tries to connect to the dongle. What is blink frequency?

The gateway keeps time and the module get their time from the gateway. The gateway get its time from a internet time server.

Is the problem going away if you remove the datetime from your JSON string?



I ran the mc-module for a few events in my code (see below) and saw the red light blink, almost like I inserted the battery, at the following times:

11:27:10
11:27:34
11:28:00
11:28:23
11:28:49
11:29:18 (should have happened, but I didn't see it go red)
11:29:35

The green light will go on (first event), 10 seconds later go off (second event), ~10 seconds later the red light will flicker, and then the green light will go on again. The Losant device rarely has its state updated (though it has worked sometimes).

I will try removing datetime soon.

Code: [Select]
Class JsonExample
   
    Const DeviceId As String = "577144f8af5318010042c29b"
    Const PublishTopic As String = "losant/" + DeviceId + "/state"
   
    Shared Event Report() RaiseEvent Every 10 Seconds
       
        // Create date object
        Dim jDate As Json = New Json
        Dim date As DateTime = DateTime.Now
        jDate.Add("$date", date)
       
        // Create data object
        Dim jData As Json = New Json
        Dim temperature As Float = TempSensor.GetTemp
        jData.Add("temperature", temperature.ToInteger)
       
        // Create state object
        Dim jState As Json = New Json
        jState.Add("time", jDate)
        jState.Add("data", jData)
       
        Lplan.Publish(PublishTopic, jState.ToListOfByte)
       
        LedGreen = Not LedGreen
    End Event
   
End Class