adriankociński

Posty: 6 Skąd: Radom\trablice
|
Wysłany: 03 Lis 08 12:56 [ Bascom] Problem z programem do robota
|
|
|
Witam
mam taki pomysł by skonstruować robota 6 nożnego w tym 18 serw, jako mechanikę użyłem Serwa modelarskie.
Nogi robota są połączone równolegle co oznacza że przednie Serwa SA połączone ze sobą więc zostaje nam tylko 9serw w programie do obsługi.
Problem polega na tym iż chciałem zastosować czujniki ultradźwiękowe ,rozpoznanie terenu ,
Wykrycie przeszkody i ominięcie jej.
O ile z samym programem wstaniem itp.. Dam rade z czujnikiem mam problem .
program narazie wygląda tak
| Kod: | $regfile = "m8def.dat"
$crystal = 10000000
$baud = 9600
Config Servos = 9 , Servo1 = Portc.9 , Servo2 = Portc.1 , Servo3 = Portc.2 , Servo4 = Portc.3 , Servo5 = Portc.4 , Servo6 = Portc.7 , Servo7 = Portc.8 , Servo8 = Portc.9 , Servo9 = Portc.10 Reload = 2
Config Portc = Output
Config Portd.0 = Input
Enable Interrupts
Servo(1) = 126
Servo(2) = 150
Servo(3) = 150
Servo(4) = 250
Servo(5) = 126
Servo(6) = 126
Servo(7) = 126
Servo(8) = 126
Servo(9) = 126
Dim Servo_pos(9) As Byte
Do
Servo_pos(1) = Servo(1)
Servo_pos(2) = Servo(2)
Servo_pos(3) = Servo(3)
Servo_pos(4) = Servo(4)
Servo_pos(5) = Servo(5)
Servo_pos(6) = Servo(6)
Servo_pos(7) = Servo(7)
Servo_pos(8) = Servo(8)
Servo_pos(9) = Servo(9)
Dim A$ As String * 1
A$ = Waitkey()
If A$ = "z" And Servo_pos(1) > 126 Then
Servo(1) = Servo_pos(1) - 1
End If
If A$ = "x" And Servo_pos(1) < 250 Then
Servo(1) = Servo_pos(1) + 1
End If
If A$ = "c" And Servo_pos(2) > 126 Then
Servo(2) = Servo_pos(2) - 1
End If
If A$ = "v" And Servo_pos(2) < 250 Then
Servo(2) = Servo_pos(2) + 1
End If
If A$ = "b" And Servo_pos(3) > 126 Then
Servo(3) = Servo_pos(3) - 1
End If
If A$ = "n" And Servo_pos(3) < 250 Then
Servo(3) = Servo_pos(3) + 1
End If
If A$ = "m" And Servo_pos(4) > 126 Then
Servo(4) = Servo_pos(4) - 1
End If
If A$ = "," And Servo_pos(4) < 250 Then
Servo(4) = Servo_pos(4) + 1
End If
If A$ = "j" And Servo_pos(5) < 126 Then
Servo(5) = Servo_pos(5) - 1
End If
If A$ = "k" And Servo_pos(6) < 126 Then
Servo(6) = Servo_pos(6) + 1
End If
If A$ = "l" And Servo_pos(7) < 126 Then
Servo(7) = Servo_pos(7) - 1
End If
If A$ = "m" And Servo_pos(8) < 126 Then
Servo(8) = Servo_pos(8) + 1
End If
If A$ = "n" And Servo_pos(9) < 126 Then
Servo(9) = Servo_pos(9) - 1
End If
Loop
End |
[ Dodano: 05 Lis 08 06:38 ]
niestety program nie reaguje na podpięcie serwa
czy ktoś może powiedzieć czy jak wpisuje
to sygnał idzie na nóżkę 2 według rysunku kolegi | Kod: | Config Pinc.0 = Output |
| Kod: | Config Servos = 1 , Servo1 = Portc.0 , Reload = 10 |
[ Dodano: 05 Lis 08 06:40 ]
 |
|
|