VERSION 4.00 Begin VB.Form Form1 BackColor = &H00000000& BorderStyle = 0 'None Caption = "Laser Pointer Organizer" ClientHeight = 4344 ClientLeft = 2904 ClientTop = 1968 ClientWidth = 7512 Height = 4728 Left = 2856 LinkTopic = "Form1" ScaleHeight = 362 ScaleMode = 3 'Pixel ScaleWidth = 626 ShowInTaskbar = 0 'False Top = 1632 Width = 7608 WindowState = 2 'Maximized Begin VB.HScrollBar ServoSlider1 Height = 120 Left = 3600 Max = 255 TabIndex = 1 Top = 3960 Width = 3600 End Begin VB.VScrollBar ServoSlider2 Height = 3600 Left = 3480 Max = 255 TabIndex = 2 Top = 360 Width = 120 End Begin VB.CommandButton EXIT Caption = "EXIT" Height = 375 Left = 840 TabIndex = 0 Top = 840 Width = 1215 End Begin MSCommLib.MSComm RS232 Left = 1320 Top = 3480 _Version = 65536 _ExtentX = 677 _ExtentY = 677 _StockProps = 0 CDTimeout = 0 CommPort = 1 CTSTimeout = 0 DSRTimeout = 0 DTREnable = 0 'False Handshaking = 0 InBufferSize = 1024 InputLen = 0 Interval = 1000 NullDiscard = 0 'False OutBufferSize = 512 ParityReplace = "?" RThreshold = 0 RTSEnable = 0 'False Settings = "4800,n,8,1" SThreshold = 0 End End Attribute VB_Name = "Form1" Attribute VB_Creatable = False Attribute VB_Exposed = False Public LaserX As Integer Public LaserY As Integer Public LaserLight As Integer Public MouseX As Single Public MouseY As Single Public MouseButton As Integer Public Servo1 As Integer Public Servo2 As Integer Public OldMouseX As Integer Public OldMouseY As Integer Sub Main() If OldMouseX <> MouseX Or OldMouseY <> MouseY Then OldMouseX = MouseX OldMouseY = MouseY Line (0, 0)-(1023, 12), RGB(0, 0, 0), BF Servo1 = Int((MouseX / (ScaleWidth - 1)) * 255) Servo2 = Int((MouseY / (ScaleHeight - 1)) * 255) ServoSlider1 = Servo1 ServoSlider2 = Servo2 End If If MouseButton = 1 Or MouseButton = 3 Then LaserLight = 1 Else LaserLight = 0 End If If RS232.PortOpen = "True" Then Msg$ = "LPO" + Chr$(255 - Servo1) + Chr$(Servo2) + Chr$(LaserLight) RS232.Output = Msg$ End If CurrentX = 0: CurrentY = 0 Print "Servo1 ="; Servo1 CurrentX = 200: CurrentY = 0 Print "Servo2 ="; Servo2 CurrentX = 400: CurrentY = 0 Print LaserLight End Sub Private Sub EXIT_Click() RS232.PortOpen = False End End Sub Private Sub Form_Activate() While 1 Main DoEvents Wend End Sub Sub Form_Initialize() RS232.CommPort = 1 RS232.Settings = "4800,n,8,1" RS232.PortOpen = True ForeColor = RGB(255, 255, 255) ScaleMode = 3 DrawWidth = 3 End Sub Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) MouseX = X MouseY = Y MouseButton = Button Main End Sub Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) MouseX = X MouseY = Y MouseButton = Button Main End Sub