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

millennial

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Red LED blinks without reference in code
« on: July 11, 2016, 11:35:56 am »
Tried again with the two following pieces of code and I am still getting red blinks as though a device reset happened. Now I am thinking it is just something with the recent MQTT bug fixes.

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

Code: [Select]
Class JsonExample
   
    Const DeviceId As String = "577144f8af5318010042c29b"
    Const PublishTopic As String = "losant/" + DeviceId + "/state"

    Shared Event Report() RaiseEvent Every 10 Seconds

        Dim payload As ListOfByte = New ListOfByte
        Dim payloadstring As String
        Dim temp As Float = TempSensor.GetTemp()
        Dim tempstring As String = temp.ToString()
       
        LedGreen = Not LedGreen
       
        payloadstring = "{\x22data\x22:{"
        payloadstring = payloadstring + "\x22temperature\x22:\x22" + tempstring + "\x22}}"
       
        payload.Add(payloadstring)
       
        Lplan.Publish(PublishTopic, payload)
        Lplan.Publish("test" + PublishTopic, payload)
       
        Thread.Sleep(1000000)
       
        LedGreen = Not LedGreen

    End Event

End Class