Sub Process_Globals
Public Serial1 As Serial
Private deviceAddress() As Byte = Array As Byte(0x28, 0xFF, 0x5E, 0x18, 0x04, 0x15, 0x03, 0x34)
Private dt As DallasTemperature
Private timer1 As Timer
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
dt.Initialize(3)
dt.SetResolution(deviceAddress, 10)
timer1.Initialize("timer1_Tick", 250)
timer1.Enabled = True
End Sub
Sub Timer1_Tick
dt.RequestTemperatures
Dim tempC As Double = dt.GetTempC(deviceAddress)
If tempC = -127 Then
Log("Error getting temperature.")
Log(dt.ToFahrenheit(tempC))
Log(dt.ToCelsius(dt.ToFahrenheit(tempC)))
Else
Log("Temperature: C: ", tempC, ", F: ", dt.ToFahrenheit(tempC))
End If
End Sub