' nonMultitaskingDemo.bas ' shows what happens if you do NOT use multitasking techniques. ' This tutorial uses a Robodyssey Mouse and Gripper ' by C.D.Odom on 5-18-06 ' www.basicxandrobotics.com ' chris_odom@georgeschool.org Option Explicit ' /////////// Globals /////////// ' Pins Const LeftServoPin as Byte = 5 ' Pin #0 on RAMB Const RightServoPin as Byte = 6 ' Pin #1 on RAMB Const GripperPin as Byte = 7 ' Pin #2 on RAMB ' Pulsewidths Const LeftForward as Single = 0.002 Const RightForward as Single = 0.001 Const GripperOpen as Single = 0.0011 Const GripperClosed as Single = 0.00175 ' /////////// Main /////////// Public Sub Main() Do Call Gripper() ' Not multitasked ' Move forward one step Call PulseOut(LeftServoPin, LeftForward, 1) Call PulseOut(RightServoPin, RightForward, 1) Call Delay(0.02) ' a necessary delay Loop End Sub ' /////////// Gripper /////////// Public Sub Gripper() Dim i as Integer ' Note Well: There is NO Do-Loop here! ' Close the Gripper's jaws For i = 1 to 20 Call PulseOut(GripperPin, GripperClosed, 1) Call Delay(0.02) Next ' Open the Gripper's jaws For i = 1 to 20 Call PulseOut(GripperPin, GripperOpen, 1) Call Delay(0.02) Next End Sub