Hello
| have been trying to write a dead simple program to monitor the PIR, run a motor for 10 seconds, turn the motor off, then sleep to reset the PIR. That is all I want it to do but it seems to just run in a loop, regardless of sensing. Its like it over runs the PIR signal:
Imports GT = Gadgeteer
Imports GTM = Gadgeteer.Modules
Namespace GadgeteerApp19
Partial Public Class Program
' This is run when the mainboard is powered up or reset.
Public Sub ProgramStarted()
Private Sub motion_Sensor_Motion_Sensed(sender As Gadgeteer.Modules.GHIElectronics.Motion_Sensor, state As Gadgeteer.Modules.GHIElectronics.Motion_Sensor.Motion_SensorState) Handles motion_Sensor.Motion_Sensed
If motion_Sensor.Motion_SensorState.Busy Then
motorControllerL298.MoveMotor(Gadgeteer.Modules.GHIElectronics.MotorControllerL298.Motor.Motor1, 100)
Thread.Sleep(10000)
motorControllerL298.MoveMotor(Gadgeteer.Modules.GHIElectronics.MotorControllerL298.Motor.Motor1, 0)
Debug.Print("hello")
Debug.Print("not running")
Thread.Sleep(5000)
End If
End Sub
End Class
End Namespace
I have tried running this with the IF statement as above but also with the code direct under the Private Sub menu.
Any help would be appreciated. Oh its Fez Cerebus, VB2012, latest firmware.
Thanks