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()


    End Sub

Private onSense As Boolean = False

    Private onSenseSeconds As Integer = 10

    Private Sub motion_Sensor_Motion_Sensed(
As Motion_Sensor,
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


        If onSense Then

            onSenseSeconds += 1

            If onSenseSeconds > 10 Then

                onSenseSeconds = 0

                onSense = False


            End If

        End If

    End Sub

End Class


🙂 PepLluis,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.