Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
Timer1.Initialize("Timer1_Tick", 3000) '1000ms = 1 second
Timer1.Enabled = True
Init_QTR
' AddLooper("Looper1") // out for now
QTR.AddListener("Change_state")
End Sub
Sub Init_QTR
QTR.Initialize(dp.D3,QTR.MODE_OUTPUT)
QTR.DigitalWrite(True)
Init_Time = Micros
' QTR_Flag = False // not used
' DelayMicroseconds(10) // Add back in if Log statement is removed
Log("Int Sub -- Cntr = ",Reset_Cntr)
Reset_Cntr = 0
Log("Int Sub")
QTR.Initialize(dp.D3,QTR.MODE_INPUT)
End Sub
Sub Change_state (State As Boolean)
If State == False Then
Decay_Time = Micros - Init_Time
Log("QTR Decay Time = ", Decay_Time)
Init_QTR
Else
Reset_Cntr = Reset_Cntr + 1
End If
End Sub
Sub Timer1_Tick
Log("Time Out ")
Log("Reset_Cntr = ",Reset_Cntr)
Init_QTR
End Sub