📄 form1.vb
字号:
Me.DO3.Name = "DO3"
Me.DO3.Size = New System.Drawing.Size(72, 24)
Me.DO3.TabIndex = 18
Me.DO3.Text = "Dig OP3"
'
'DO4
'
Me.DO4.Location = New System.Drawing.Point(256, 208)
Me.DO4.Name = "DO4"
Me.DO4.Size = New System.Drawing.Size(72, 24)
Me.DO4.TabIndex = 19
Me.DO4.Text = "Dig OP4"
'
'DIP1
'
Me.DIP1.Location = New System.Drawing.Point(104, 344)
Me.DIP1.Name = "DIP1"
Me.DIP1.Size = New System.Drawing.Size(72, 24)
Me.DIP1.TabIndex = 20
Me.DIP1.Text = "Dig IP1"
'
'DIP2
'
Me.DIP2.Location = New System.Drawing.Point(104, 368)
Me.DIP2.Name = "DIP2"
Me.DIP2.Size = New System.Drawing.Size(72, 24)
Me.DIP2.TabIndex = 21
Me.DIP2.Text = "Dig IP2"
'
'DIP3
'
Me.DIP3.Location = New System.Drawing.Point(104, 392)
Me.DIP3.Name = "DIP3"
Me.DIP3.Size = New System.Drawing.Size(72, 24)
Me.DIP3.TabIndex = 22
Me.DIP3.Text = "Dig IP3"
'
'DIP6
'
Me.DIP6.Location = New System.Drawing.Point(192, 392)
Me.DIP6.Name = "DIP6"
Me.DIP6.Size = New System.Drawing.Size(72, 24)
Me.DIP6.TabIndex = 25
Me.DIP6.Text = "Dig IP6"
'
'DIP5
'
Me.DIP5.Location = New System.Drawing.Point(192, 368)
Me.DIP5.Name = "DIP5"
Me.DIP5.Size = New System.Drawing.Size(72, 24)
Me.DIP5.TabIndex = 24
Me.DIP5.Text = "Dig IP5"
'
'DIP4
'
Me.DIP4.Location = New System.Drawing.Point(192, 344)
Me.DIP4.Name = "DIP4"
Me.DIP4.Size = New System.Drawing.Size(72, 24)
Me.DIP4.TabIndex = 23
Me.DIP4.Text = "Dig IP4"
'
'GroupBox1
'
Me.GroupBox1.Location = New System.Drawing.Point(24, 96)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(312, 184)
Me.GroupBox1.TabIndex = 26
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "GroupBox1"
'
'GroupBox2
'
Me.GroupBox2.Location = New System.Drawing.Point(24, 328)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(312, 96)
Me.GroupBox2.TabIndex = 27
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "Inputs"
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(40, 16)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(152, 40)
Me.Label6.TabIndex = 28
Me.Label6.Text = "MotorBee Must be Initialised using this button before any controls below are used" & _
""
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(360, 454)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.DIP6)
Me.Controls.Add(Me.DIP5)
Me.Controls.Add(Me.DIP4)
Me.Controls.Add(Me.DIP3)
Me.Controls.Add(Me.DIP2)
Me.Controls.Add(Me.DIP1)
Me.Controls.Add(Me.DO4)
Me.Controls.Add(Me.DO3)
Me.Controls.Add(Me.DO2)
Me.Controls.Add(Me.DO1)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.servo)
Me.Controls.Add(Me.on4)
Me.Controls.Add(Me.on3)
Me.Controls.Add(Me.on2)
Me.Controls.Add(Me.on1)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.speed4)
Me.Controls.Add(Me.speed3)
Me.Controls.Add(Me.speed2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.speed1)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.GroupBox2)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Declare Function InitMotoBee Lib "mtb.dll" () As Boolean
Declare Function Digital_IO Lib "mtb.dll" (ByRef inputs As Integer, ByVal outputs As Integer) As Boolean
Declare Function SetMotors Lib "mtb.dll" (ByVal on1 As Integer, ByVal speed1 As Integer, ByVal on2 As Integer, ByVal speed2 As Integer, ByVal on3 As Integer, ByVal speed3 As Integer, ByVal on4 As Integer, ByVal speed4 As Integer, ByVal servo As Integer) As Boolean
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
InitMotoBee() ' initialise the MotorBee
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim s1, s2, s3, s4 As Integer
Dim o1, o2, o3, o4 As Integer
Dim sv As Integer
Dim inputs As Integer
Dim outputs As Integer
s1 = speed1.Text
s2 = speed2.Text
s3 = speed3.Text
s4 = speed4.Text
sv = servo.Text
If on1.Checked Then
o1 = 1
Else
o1 = 0
End If
If on2.Checked Then
o2 = 1
Else
o2 = 0
End If
If on3.Checked Then
o3 = 1
Else
o3 = 0
End If
If on4.Checked Then
o4 = 1
Else
o4 = 0
End If
SetMotors(o1, s1, o2, s2, o3, s3, o4, s4, sv)
outputs = 0
If DO1.Checked Then
outputs = outputs Or 1
End If
If DO2.Checked Then
outputs = outputs Or 2
End If
If DO3.Checked Then
outputs = outputs Or 4
End If
If DO4.Checked Then
outputs = outputs Or 8
End If
Digital_IO(inputs, outputs)
If ((inputs And 1) = 0) Then
DIP1.Checked() = False
Else
DIP1.Checked() = True
End If
If ((inputs And 2) = 0) Then
DIP2.Checked() = False
Else
DIP2.Checked() = True
End If
If ((inputs And 4) = 0) Then
DIP3.Checked() = False
Else
DIP3.Checked() = True
End If
If ((inputs And 8) = 0) Then
DIP4.Checked() = False
Else
DIP4.Checked() = True
End If
If ((inputs And 16) = 0) Then
DIP5.Checked() = False
Else
DIP5.Checked() = True
End If
If ((inputs And 32) = 0) Then
DIP6.Checked() = False
Else
DIP6.Checked() = True
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -