M:\Mike (latest)\Stub Programs\Simple Joystick - Doneprinter\Form1.frm
File saved: 4/20/2006 11:05:32 PM
Generated: 4/30/2006 4:52:55 PM
Table of Contents (Designer Object Definition) Declarations Move_Servo Form_Load Center_Click Forward_Click Left_Click leftmid_Click Reverse_Click Right_Click rightmid_Click STOP_Click threesixtyleft_Click threesixtyright_Click
VERSION 5.00 Table of Contents Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX" Begin VB.Form Form1 Caption = "S" ClientHeight = 4590 ClientLeft = 60 ClientTop = 450 ClientWidth = 6030 LinkTopic = "Form1" ScaleHeight = 4590 ScaleWidth = 6030 StartUpPosition = 3 'Windows Default Begin VB.CommandButton rightmid Caption = "Right 4" Height = 495 Left = 1920 TabIndex = 12 Top = 2760 Width = 735 End Begin VB.CommandButton leftmid Caption = "Left 4" Height = 495 Left = 240 TabIndex = 11 Top = 2760 Width = 735 End Begin VB.CommandButton threesixtyright Caption = "360 R" Height = 495 Left = 2040 TabIndex = 10 Top = 1320 Width = 735 End Begin VB.CommandButton threesixtyleft Caption = "360 L" Height = 495 Left = 240 TabIndex = 9 Top = 1320 Width = 735 End Begin VB.CommandButton Center Caption = "Center" Height = 495 Left = 1080 TabIndex = 7 Top = 2400 Width = 735 End Begin VB.CommandButton Reverse Caption = "Reverse" Height = 495 Left = 1080 TabIndex = 6 Top = 3000 Width = 735 End Begin VB.CommandButton STOP BackColor = &H000000FF& Caption = "STOP" BeginProperty Font Name = "MS Sans Serif" Size = 24 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 1095 Left = 3480 MaskColor = &H000000FF& Style = 1 'Graphical TabIndex = 5 Top = 360 Width = 2295 End Begin VB.CommandButton Right Caption = "Right 2" Height = 495 Left = 1920 TabIndex = 4 Top = 2160 Width = 735 End Begin VB.CommandButton Left Caption = "Left 2" Height = 495 Left = 240 TabIndex = 3 Top = 2160 Width = 735 End Begin VB.CommandButton Forward Caption = "Forward" Height = 495 Left = 1080 TabIndex = 2 Top = 1800 Width = 735 End Begin VB.ListBox OUT Height = 1035 Left = 3480 TabIndex = 0 Top = 2640 Width = 2175 End Begin MSCommLib.MSComm Comm Left = 4680 Top = 3840 _ExtentX = 1005 _ExtentY = 1005 _Version = 393216 DTREnable = -1 'True End Begin VB.Line Line6 BorderWidth = 3 X1 = 3240 X2 = 3240 Y1 = 2160 Y2 = 240 End Begin VB.Line Line2 BorderWidth = 3 X1 = 3240 X2 = 3240 Y1 = 2040 Y2 = 4440 End Begin VB.Line Line4 BorderWidth = 3 X1 = 3240 X2 = 6000 Y1 = 2040 Y2 = 2040 End Begin VB.Line Line7 BorderWidth = 3 X1 = 3240 X2 = 6000 Y1 = 240 Y2 = 240 End Begin VB.Line Line5 BorderWidth = 3 X1 = 0 X2 = 6000 Y1 = 240 Y2 = 240 End Begin VB.Label Label4 Alignment = 2 'Center Caption = "Joystick Controls" Height = 255 Left = 120 TabIndex = 8 Top = 0 Width = 2775 End Begin VB.Label Label5 Caption = "Outgoing Commands" Height = 255 Left = 3600 TabIndex = 1 Top = 1800 Width = 2055 End End
Attribute VB_Name = "Form1" Table of Contents Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False '************************************************************************ '********************************************************* '****************************************** ' Created By: Michael Konicki ' Date: 4/20/2006 (last edit) ' 'This program provides simple control of the Airens robot. 'For more features use the advanced version of this program as this 'one only allows the use of built in stamp routines. ' '****************************************** '********************************************************* '************************************************************************ Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ '$$$$$$ CUSTOM FUNCTION $$$$$$$$$$$$$$$$ '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Private Function Move_Servo(movee As String) Table of Contents '**************************************************** 'Sends the actual data to the comport for the robot to process '**************************************************** 'Send the command to the robot to do whatever built in movement is required Comm.Output = "11" + " " + movee + " " + " " + "0" + " " + "22" + " " Sleep (50) End Function '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ '$$$$$$ FORM LOAD $$$$$$$$$$$$$$$$ '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Private Sub Form_Load() Table of Contents '**************************************************** ' Open the comport for the robot at startup '**************************************************** Comm.CommPort = 3 Comm.PortOpen = True End Sub '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ '$$$$$$ FORM CLICKS $$$$$$$$$$$$$$$$ '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Private Sub Center_Click() Table of Contents '**************************************************** 'Center the wheels of the robot, but doesnt stop momentum '**************************************************** 'center the wheels Call Move_Servo(2) OUT.AddItem "Center WHeels" End Sub
Private Sub Forward_Click() Table of Contents '**************************************************** ' Move the robot forward '**************************************************** Call Move_Servo(1) OUT.AddItem "Going Forward" End Sub
Private Sub Left_Click() Table of Contents '**************************************************** 'turn the front 2 wheels left '**************************************************** 'Turn the wheels left Call Move_Servo(4) OUT.AddItem "Left 2wheels" End Sub
Private Sub leftmid_Click() Table of Contents '**************************************************** 'Turn the front 2 wheels and 2 rear wheels to turn the robot 'left '**************************************************** 'Turn the wheels left Call Move_Servo(8) OUT.AddItem "Left 4wheels" End Sub
Private Sub Reverse_Click() Table of Contents '**************************************************** 'Move the robot back '**************************************************** 'Center the wheels Call Move_Servo(3) OUT.AddItem "Going Backwards" End Sub
Private Sub Right_Click() Table of Contents '**************************************************** 'turn the front 2 wheels to make the robot go right '**************************************************** 'Turn the wheels Right Call Move_Servo(5) OUT.AddItem "Right 2wheels" End Sub
Private Sub rightmid_Click() Table of Contents '**************************************************** 'Turn the front 2 and read 2 wheels to make the robot go 'right '**************************************************** 'Turn the wheels Right Call Move_Servo(9) OUT.AddItem "Right 4wheels" End Sub
Private Sub STOP_Click() Table of Contents '**************************************************** 'stop the robot, but dont center wheels, just stop '**************************************************** Call Move_Servo(0) OUT.AddItem "Stopping" End Sub
Private Sub threesixtyleft_Click() Table of Contents '**************************************************** 'Spin the robot in a 360 left '**************************************************** 'Position the tires Call Move_Servo(6) OUT.AddItem "360 Left" End Sub
Private Sub threesixtyright_Click() Table of Contents '**************************************************** 'Spin the robot in a 360 right '**************************************************** 'Position the tires Call Move_Servo(7) OUT.AddItem "360 Right" End Sub