VERSION 5.00
Object = "{C6114D03-59EB-48D0-96E6-A27A8A65F021}#1.0#0"; "Phantom.dll"
Begin VB.Form Y2K_Speed
Caption = "Y2K For Atonomous Speed Circuit"
ClientHeight = 4065
ClientLeft = 60
ClientTop = 345
ClientWidth = 5685
LinkTopic = "Form1"
ScaleHeight = 4065
ScaleWidth = 5685
StartUpPosition = 3 'Windows の既定値
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 1215
Left = 720
TabIndex = 0
Top = 120
Width = 1335
End
Begin PHANTOMLibCtl.PhantomCtrl RCX
Left = 0
Top = 0
ComPortNo = 0
LinkType = 0
Brick = 0
End
End
Attribute VB_Name = "Y2K_Speed"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim white As Integer
Dim blue As Integer
Dim silver As Integer
white = 22
blue = 35
silver = 50
RCX.SelectPrgm (4)
With RCX
.BeginOfTask (0)
.SetSensorType 1, 3
.SetSensorMode 1, 4, 0
.SetFwd "1"
.Loop 2, 0
.If 9, 1, 1, 2, white
.SetPower 0, 2, 5
.On "0"
.On "1"
.Else
.SetPower 0, 2, 7
.SetFwd "1"
.On "0"
.Off "1"
.If 9, 1, 1, 2, blue
.SetPower 0, 2, 5
.SetRwd "1"
.On "0"
.On "1"
.If 9, 1, 0, 2, silver
.PlaySystemSound 1
.SetPower 0, 2, 7
.SetFwd "1"
.On "0"
.Off "1"
.EndIf
.EndIf
.EndIf
.EndLoop
.EndOfTask
End With
End Sub
Private Sub Form_Load()
RCX.InitComm
End Sub
Private Sub Form_Unload(Cancel As Integer)
RCX.CloseComm
End Sub |
このプログラムの基本的な構造は