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,

Leave a Reply

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


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>