Thanks to Erel for this great product !! (again)
Here's a PIR example (presence detection) with Arduino and B4R; the PIR sensor is the PIR HC-SR501
Code:
Here's a PIR example (presence detection) with Arduino and B4R; the PIR sensor is the PIR HC-SR501
Code:
B4X:
#Region Project Attributes
#AutoFlushLogs: True
#StackBufferSize: 300
#End Region
Sub Process_Globals
Public Serial1 As Serial
Private pin13 As Pin
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
pin13.Initialize (13, pin13.MODE_INPUT_PULLUP)
pin13.AddListener("Change_state")
End Sub
Sub Change_state (State As Boolean)
Select Case State
Case True
Log("state: Detected")
Case False
Log("state: Not Detected")
End Select
End Sub