📄 main.frm
字号:
Line Input #intfreefile, motor
Line Input #intfreefile, Speed
Line Input #intfreefile, position
VScroll17 = position ': SendData Val(motor), Val(Speed), Val(position): For dely = 1 To 10000: Next dely
Line Input #intfreefile, motor
Line Input #intfreefile, Speed
Line Input #intfreefile, position
VScroll18 = position ': SendData Val(motor), Val(Speed), Val(position): For dely = 1 To 10000: Next dely
3090 Close #intfreefile
Picture1 = LoadPicture
End Function
Private Sub Form_Load()
'Initalize the motors and set them to the center position
'then turn them off
Set ComOCX = frmAlpha.MSComm
OpenSerial Val("1"), "9600,n,8,1"
Label1.Caption = "SPEED: " + Str(HScroll1)
Call CENTER_SERVOS
Call TurnOffServos
Picture1 = LoadPicture
End Sub
Private Sub HScroll1_Change()
' Range of speed is 0, 1, 2, and 3 (Four speed selection)
Label1.Caption = "SPEED: " + Str(HScroll1)
Speed = HScroll1
End Sub
Private Sub Command4_Click()
Call CENTER_SERVOS
End Sub
Private Sub Command6_Click()
Call TurnOffServos
End Sub
Public Sub TurnOffServos()
'( Z ) - (Open Stance) <----- ACCEPTING <----- ( CALM ) ----->
'STEM ----> (Closed Stance)
'( X ) - (High Arousal) <----- SURPRIZE <----- ALERT <----- ( CALM ) ----->
'TIRED ----> (Low Arousal)
'( Y ) - (Negative Valance) <---- UNHAPPY <----- ( CALM ) ----->
'CONTENT ----> (Positive Valence)
Dim dely As Integer
For motor = 1 To 24
Speed = 0
SendData Val(motor), Val(Speed), Val(position)
Next motor
For dely = 1 To 10000: Next dely
End Sub
Public Sub CENTER_SERVOS()
Dim dely As Integer
Dim dely1 As Integer
For motor = 1 To 3
Speed = 1
position = 128
SendData Val(motor), Val(Speed), Val(position)
Next motor
For dely = 1 To 600
For dely1 = 1 To 30000
Next dely1
DoEvents
Next dely
For motor = 4 To 24
Speed = 1
position = 128
SendData Val(motor), Val(Speed), Val(position)
Next motor
VScroll1.Value = 128
For dely = 1 To 30000: Next dely
VScroll2.Value = 128
For dely = 1 To 30000: Next dely
VScroll3.Value = 128
For dely = 1 To 600
For dely1 = 1 To 30000
Next dely1
DoEvents
Next dely
VScroll4.Value = 128
For dely = 1 To 30000: Next dely
VScroll5.Value = 128
For dely = 1 To 30000: Next dely
VScroll6.Value = 128
For dely = 1 To 30000: Next dely
VScroll7.Value = 128
For dely = 1 To 30000: Next dely
VScroll8.Value = 128
For dely = 1 To 30000: Next dely
VScroll9.Value = 128
For dely = 1 To 30000: Next dely
VScroll10.Value = 128
For dely = 1 To 30000: Next dely
VScroll11.Value = 128
For dely = 1 To 30000: Next dely
VScroll12.Value = 128
For dely = 1 To 30000: Next dely
VScroll13.Value = 128
For dely = 1 To 30000: Next dely
VScroll14.Value = 128
For dely = 1 To 30000: Next dely
VScroll15.Value = 128
For dely = 1 To 30000: Next dely
VScroll16.Value = 128
For dely = 1 To 30000: Next dely
VScroll17.Value = 128
For dely = 1 To 30000: Next dely
VScroll18.Value = 128
For dely = 1 To 30000: Next dely
VScroll19.Value = 128
VScroll20.Value = 128
VScroll21.Value = 128
VScroll22.Value = 128
VScroll23.Value = 128
VScroll24.Value = 128
End Sub
Private Sub VScroll1_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(1), Val(Speed), Val(VScroll1)
Text5.Text = VScroll1
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll19_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(19), Val(Speed), Val(VScroll19)
Text7.Text = VScroll19
For dely = 1 To 10000: Next dely
End Sub
Public Sub VScroll20_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(20), Val(Speed), Val(VScroll20)
Text6.Text = VScroll20
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll10_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(10), Val(Speed), Val(VScroll10)
Text16.Text = VScroll10
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll11_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(11), Val(Speed), Val(VScroll11)
Text17.Text = VScroll11
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll12_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(12), Val(Speed), Val(VScroll12)
Text18.Text = VScroll12
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll13_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(13), Val(Speed), Val(VScroll13)
Text19.Text = VScroll13
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll14_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(14), Val(Speed), Val(VScroll14)
Text20.Text = VScroll14
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll15_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(15), Val(Speed), Val(VScroll15)
Text21.Text = VScroll15
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll16_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(16), Val(Speed), Val(VScroll16)
Text22.Text = VScroll16
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll17_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(17), Val(Speed), Val(VScroll17)
Text23.Text = VScroll17
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll18_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(18), Val(Speed), Val(VScroll18)
Text24.Text = VScroll18
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll2_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(2), Val(Speed), Val(VScroll2)
Text8.Text = VScroll2
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll21_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(21), Val(Speed), Val(VScroll21)
Text25.Text = VScroll21
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll22_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(22), Val(Speed), Val(VScroll22)
Text26.Text = VScroll22
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll23_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(23), Val(Speed), Val(VScroll23)
Text27.Text = VScroll23
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll24_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(24), Val(Speed), Val(VScroll24)
Text28.Text = VScroll24
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll3_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(3), Val(Speed), Val(VScroll3)
Text9.Text = VScroll3
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll4_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(4), Val(Speed), Val(VScroll4)
Text10.Text = VScroll4
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll5_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(5), Val(Speed), Val(VScroll5)
Text11.Text = VScroll5
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll6_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(6), Val(Speed), Val(VScroll6)
Text12.Text = VScroll6
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll7_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(7), Val(Speed), Val(VScroll7)
Text13.Text = VScroll7
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll8_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(8), Val(Speed), Val(VScroll8)
Text14.Text = VScroll8
For dely = 1 To 10000: Next dely
End Sub
Private Sub VScroll9_Change()
Dim dely As Integer
Speed = HScroll1
SendData Val(9), Val(Speed), Val(VScroll9)
Text15.Text = VScroll9
For dely = 1 To 10000: Next dely
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set frmAlpha = Nothing
CloseSerial
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -