Gadgeteer : Playing with Cerberus, Motion Module and Visual Studio 2012

 Code :

Partial Public Class Program

    ‘Playing with Cerberus and the Motion Module

    Private WithEvents timer As GT.Timer = New GT.Timer(1000)

    Public Sub ProgramStarted()

        timer.Start()

    End Sub


   
Private onSense As Boolean = False

    Private onSenseSeconds As Integer = 10

    Private Sub motion_Sensor_Motion_Sensed(
               sender
As Motion_Sensor,
               state
As Motion_Sensor.Motion_SensorState

               ) Handles motion_Sensor.Motion_Sensed

        If onSense Then Exit Sub

        onSense = True

        led7r.Animate(100, False, True, False)

        led7r.TurnLightOn(7, True)

    End Sub


   
Private Sub timer_Tick(timer As Gadgeteer.Timer) Handles timer.Tick

        PulseDebugLED()

        If onSense Then

            onSenseSeconds += 1

            If onSenseSeconds > 10 Then

                onSenseSeconds = 0

                onSense = False

                led7r.TurnLightOff(7)

            End If

        End If

    End Sub

End Class

 

🙂 PepLluis,

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *