دوستان من با یک مکافاتی این برنامه رو پیدا کردم ولی من فقط می خوام موتورم راست یا چپ یا وسط دوران کنه کسی میتونه این کد رو یه توضیح بده که فقط این کار رو انجام بده؟
کسی میتونه بگه این قسمت ها از کد چی میگه؟
Servospeed = 3
Negservospeed = -3
I = 0
و
Centerservo = 640
Rightservo = 430
Leftservo = 850
بعد اومده گفته :
For I = Centerservo To Rightservo Step Negservospeed
Pulseout Portb , 4 , I
خوب این یعنی چی؟
اصلا" این عدد ها یعنی چی ؟
crystal = 1000000
Dim Servospeed As Integer
Dim Negservospeed As Integer
Dim I As Integer
Dim Centerservo As Integer
Dim Leftservo As Integer
Dim Rightservo As Integer
Config Pinb.4 = Output 'servo signal
Config Pinb.0 = Input '2ms throw button
Config Pinb.1 = Input '1ms throw button
Config Pinb.2 = Input 'fast button
Portb.4 = 0
Servospeed = 3
Negservospeed = -3
I = 0
Centerservo = 640
Rightservo = 430
Leftservo = 850
Wait 1
Loop:
If Pinb.0 = 0 Then
'Slow Speed
If Pinb.1 = 0 Then '1ms pulse out
For I = Centerservo To Rightservo Step Negservospeed
Pulseout Portb , 4 , I
Waitms 20
Next
End If
If Pinb.2 = 0 Then
For I = Centerservo To Leftservo Step Servospeed
Pulseout Portb , 4 , I
Waitms 20
Next
End If
If Pinb.1 = 1 And Pinb.2 = 1 Then
Pulseout Portb , 4 , Centerservo
Waitms 20
End If
Else
'Fast speed
If Pinb.1 = 0 Then '1ms pulses
Pulseout Portb , 4 , Rightservo
Waitms 20
End If
If Pinb.2 = 0 Then
Pulseout Portb , 4 , Leftservo '2ms pulses
Waitms 20
End If
If Pinb.1 = 1 And Pinb.2 = 1 Then '1.5ms pulses
Pulseout Portb , 4 , Centerservo
Waitms 20
End If
End If
Goto Loop
End
Dim Servospeed As Integer
Dim Negservospeed As Integer
Dim I As Integer
Dim Centerservo As Integer
Dim Leftservo As Integer
Dim Rightservo As Integer
Config Pinb.4 = Output 'servo signal
Config Pinb.0 = Input '2ms throw button
Config Pinb.1 = Input '1ms throw button
Config Pinb.2 = Input 'fast button
Portb.4 = 0
Servospeed = 3
Negservospeed = -3
I = 0
Centerservo = 640
Rightservo = 430
Leftservo = 850
Wait 1
Loop:
If Pinb.0 = 0 Then
'Slow Speed
If Pinb.1 = 0 Then '1ms pulse out
For I = Centerservo To Rightservo Step Negservospeed
Pulseout Portb , 4 , I
Waitms 20
Next
End If
If Pinb.2 = 0 Then
For I = Centerservo To Leftservo Step Servospeed
Pulseout Portb , 4 , I
Waitms 20
Next
End If
If Pinb.1 = 1 And Pinb.2 = 1 Then
Pulseout Portb , 4 , Centerservo
Waitms 20
End If
Else
'Fast speed
If Pinb.1 = 0 Then '1ms pulses
Pulseout Portb , 4 , Rightservo
Waitms 20
End If
If Pinb.2 = 0 Then
Pulseout Portb , 4 , Leftservo '2ms pulses
Waitms 20
End If
If Pinb.1 = 1 And Pinb.2 = 1 Then '1.5ms pulses
Pulseout Portb , 4 , Centerservo
Waitms 20
End If
End If
Goto Loop
End
کسی میتونه بگه این قسمت ها از کد چی میگه؟
Servospeed = 3
Negservospeed = -3
I = 0
و
Centerservo = 640
Rightservo = 430
Leftservo = 850
بعد اومده گفته :
For I = Centerservo To Rightservo Step Negservospeed
Pulseout Portb , 4 , I
خوب این یعنی چی؟
اصلا" این عدد ها یعنی چی ؟