Author Topic: Connection Problem  (Read 922 times)


  • Full Member
  • ***
  • Posts: 215
    • View Profile
Re: Connection Problem
« on: July 20, 2016, 12:49:41 pm »
This is what I'm doing

Code: [Select]
// This example logs the mc Unique IDentifier (mcUID) and the Temperature
// to MQTT.

Class Temperature
    Shared mcUIDString As String
    Shared Event Boot()
        mcUIDString = Device.mcUID().ToString()
    End Event
    Shared Event GetTemp() RaiseEvent Every 1 Minutes
        LedGreen = True
        Dim TempC As Float = TempSensor.GetTemp
        Dim Temppayload As ListOfByte = New ListOfByte()
        Lplan.Publish("MCThings/" + mcUIDString + "/Temperature", Temppayload)
        LedGreen = False
    End Event
    Shared Event GetUptime() RaiseEvent Every 1 Minutes
        //LedRed = True
        Dim uptime As Integer = Device.Uptime()
        //Dim uptimeString As String = uptime.ToString()
        Dim Uptimepayload As ListOfByte = New ListOfByte()
        Lplan.Publish("MCThings/" + mcUIDString + "/Uptime", Uptimepayload)
        //LedRed = False
    End Event
    //Shared Event CheckVoltage() RaiseEvent Every 2 Days
    Shared Event CheckVoltage() RaiseEvent Every 2 Minutes
        Dim BattVolt As Short = Device.BatteryVoltage
        Dim Battpayload As ListOfByte = New ListOfByte()
        Lplan.Publish("MCThings/" + mcUIDString + "/BatteryVoltage", Battpayload)
        //If BattVolt < 2200 Then
        //Lplan.IFTTT("YOURIFTTTKETHERE", "ProductionRoomBattery/YOURTOPICHERE")
        //End If
    End Event
End Class

I think it's the
Code: [Select]
Uptimepayload.Add(uptime.ToString) that is the problem, as the one module I have that is working keeps resetting, but does publish from time to time. (that's why uptime is always 0).

I'm currently stuck in debug mode - so as soon as I get out of that I'll revert to the two step assignment and see if that fixes the reset.