barcode scanner vb.net textbox JOYSTICK2.BAS in Software

Creation ECC200 in Software JOYSTICK2.BAS

LISTING 34.1 JOYSTICK2.BAS
Data Matrix ECC200 Decoder In None
Using Barcode Control SDK for Software Control to generate, create, read, scan barcode image in Software applications.
Data Matrix ECC200 Encoder In None
Using Barcode maker for Software Control to generate, create Data Matrix image in Software applications.
Private Private Private Private Private Private S1 As Byte S2 As Byte JoystickX As Integer JoystickY As Integer Steps As Integer TempByte As Byte
Reading DataMatrix In None
Using Barcode decoder for Software Control to read, scan read, scan image in Software applications.
Painting ECC200 In C#.NET
Using Barcode printer for Visual Studio .NET Control to generate, create Data Matrix ECC200 image in .NET applications.
538 REMOTE CONTROL SYSTEMS
Encode ECC200 In Visual Studio .NET
Using Barcode generator for ASP.NET Control to generate, create Data Matrix ECC200 image in ASP.NET applications.
Encode Data Matrix In .NET
Using Barcode generator for .NET framework Control to generate, create Data Matrix 2d barcode image in VS .NET applications.
+5 vdc
Data Matrix 2d Barcode Creator In Visual Basic .NET
Using Barcode encoder for Visual Studio .NET Control to generate, create ECC200 image in VS .NET applications.
Code 128A Generator In None
Using Barcode creation for Software Control to generate, create Code128 image in Software applications.
100K
Making UCC.EAN - 128 In None
Using Barcode encoder for Software Control to generate, create EAN / UCC - 13 image in Software applications.
Generating UPC-A Supplement 2 In None
Using Barcode generator for Software Control to generate, create UCC - 12 image in Software applications.
100K
Bar Code Drawer In None
Using Barcode printer for Software Control to generate, create bar code image in Software applications.
Barcode Drawer In None
Using Barcode encoder for Software Control to generate, create barcode image in Software applications.
Pin 20
USPS Confirm Service Barcode Maker In None
Using Barcode generator for Software Control to generate, create USPS PLANET Barcode image in Software applications.
Reading Data Matrix 2d Barcode In Visual Studio .NET
Using Barcode recognizer for VS .NET Control to read, scan read, scan image in .NET applications.
Pin 15
Data Matrix ECC200 Maker In Java
Using Barcode drawer for Java Control to generate, create ECC200 image in Java applications.
Bar Code Encoder In VB.NET
Using Barcode creator for .NET framework Control to generate, create barcode image in .NET applications.
Pin 19
Barcode Printer In VB.NET
Using Barcode creation for .NET Control to generate, create barcode image in .NET applications.
GTIN - 12 Creation In Visual C#.NET
Using Barcode generation for .NET Control to generate, create UPC Code image in Visual Studio .NET applications.
100K .01 F 100K .01 F
Matrix 2D Barcode Maker In C#.NET
Using Barcode generation for .NET framework Control to generate, create 2D Barcode image in .NET applications.
1D Creation In VS .NET
Using Barcode printer for ASP.NET Control to generate, create Linear Barcode image in ASP.NET applications.
Pin 16
Pins 17, 18 FIGURE 34.3 Connecting an IBM PC-style joystick to the BasicX-24 microcontroller.
Private Private Private Private Private Private Private Private Private Private Private Private Private Motors As Byte MotorsStr As String * 10 TempStr As String * 20 RecordFlag As Boolean PlayFlag As Boolean Const GreenLED As Byte = 26 Const RedLED As Byte = 25 Const LEDon As Byte = 0 Const LEDoff As Byte = 1 Const Const Const Const MotLD MotLC MotRD MotRC As As As As Byte Byte Byte Byte = = = = 9 10 11 12
Private Const Min As Integer = 450 Private Const Mid As Integer = 850 Private Const Max As Integer = 1200 Private Const CmdDelay As Integer = 256 Private Const MaxSteps As Integer = 60 Dim RecordArray (1 to MaxSteps) As Integer 'DLDR 'D=0, 'D=1, 'L=0, 'L=1, 'R=0, 'R=1, four bit format (see text) forward reverse left motor off left motor on right motor off Right motor on
Sub Main() Dim Count As Integer Call PutPin (17, BxOutputLow)
' take low
BUILDING A JOYSTICK TEACHING PENDANT 539
Call PutPin (18, BxOutputLow) Call OpenSerialPort(1, 19200) RecordFlag = False PlayFlag = False
' take low
Call PutPin (GreenLED, LedOff) Call Sleep (1.5) Do JoystickX = GetPotValue (19) ' X stick JoystickY = GetPotValue (16) ' Y stick Select Case JoyStickY Case Min to (Mid-51) 'Forward Select Case JoystickX Case Min to (Mid-51) MotorsStr = "bx00000100" Motors = bx00000100 Case (Mid-50) to (Mid+50) MotorsStr = "bx00000101" Motors = bx00000101 Case Mid+51 to Max MotorsStr = "bx00000001" Motors = bx00000001 End Select Case (Mid-50) to (Mid+50) ' Center Select Case JoystickX Case Min to (Mid-51) MotorsStr = "bx00001101" Motors = bx00001101 Case (Mid-50) to (Mid+50) MotorsStr = "bx00000000" Motors = bx00000000 Case Mid+51 to Max MotorsStr = "bx00000111" Motors = bx00000111 End Select Case Mid+51 to Max ' Reverse Select Case JoystickX Case Min to (Mid-51) MotorsStr = "bx00001100" Motors = bx00001100 Case (Mid-50) to (Mid+50) MotorsStr = "bx00001111" Motors = bx00001111 Case Mid+51 to Max MotorsStr = "bx00000011" Motors = bx00000011 End Select End Select Call SetMotors (Motors) Call PutStr (MotorsStr) Call Newline S1 = GetPin (20) S2 = GetPin (15) If S1 = 0 Then ' button 2, red led, pin 20 RecordFlag = Not RecordFlag Call SetRedLed (RecordFlag) If RecordFlag = True Then Steps = 1 TempStr = "***Recording On***" Call PutStr (TempStr) Call Newline End If If RecordFlag = False Then
540 REMOTE CONTROL SYSTEMS
TempStr = ***Recording Off*** Call PutStr (TempStr) Call Newline End If End If If S2 = 0 Then ' button 1, green led, pin 15 PlayFlag = Not PlayFlag Call SetGreenLed (PlayFlag) If PlayFlag = True Then TempStr = "***Playback On***" Call PutStr (TempStr) Call Newline End If End If If RecordFlag = True Then If Steps <= MaxSteps Then RecordArray(Steps) = CInt(Motors) Call PutI (RecordArray(Steps)) Call Newline Steps = Steps + 1 End If End If If PlayFlag = True Then RecordFlag = False Call SetRedLed (RecordFlag) For Count = 1 to (Steps - 1) Call PutI (RecordArray(Count)) TempByte = CByte(RecordArray (Count)) Call SetMotors (TempByte) Call Newline Call Sleep (CmdDelay) If GetPin (15) = 0 Then PlayFlag = False Call PutPin (GreenLED, LedOff) Exit For End If Next PlayFlag = False Call PutPin (GreenLED, LedOff) End If Call Sleep (CmdDelay) Loop End Sub Private Sub SetMotors (Motors As Byte) Select Case Motors Case 0 ' all stop Call PutPin (MotLD, 0) Call PutPin (MotLC, 0) Call PutPin (MotRD, 0) Call PutPin (MotRC, 0) Case 5 ' forward Call PutPin (MotLD, 0) Call PutPin (MotLC, 1) Call PutPin (MotRD, 0) Call PutPin (MotRC, 1) Case 15 ' reverse Call PutPin (MotLD, 1) Call PutPin (MotLC, 1) Call PutPin (MotRD, 1) Call PutPin (MotRC, 1) Case 1 ' right Call PutPin (MotLD, 0)
Copyright © OnBarcode.com . All rights reserved.