Hey Guys,
Made a few things with Picaxe equipment before but this is my first robot. It is actually for a project at school and our brief is to create a prototype for a Rover that would be able to carry a small labatory.
We are basing our design of this Spirit II rover we saw here: http://beatty-robotics.com/spirit-ii-mars-rover We really liked how it moved as it was simple yet effective and had good suspension.
Anyway, I wrote a program for it as if it had switches on the rover and it works the same as the one on the website. Just need some assistance in working out how to make it go wirelessly. Not asking you to do it for me, just some guidance and maybe a few lines of code to get me started.
Thanks,
Matt
Made a few things with Picaxe equipment before but this is my first robot. It is actually for a project at school and our brief is to create a prototype for a Rover that would be able to carry a small labatory.
We are basing our design of this Spirit II rover we saw here: http://beatty-robotics.com/spirit-ii-mars-rover We really liked how it moved as it was simple yet effective and had good suspension.
Anyway, I wrote a program for it as if it had switches on the rover and it works the same as the one on the website. Just need some assistance in working out how to make it go wirelessly. Not asking you to do it for me, just some guidance and maybe a few lines of code to get me started.
Thanks,
Matt
Code:
; GOLD CREST PROJECT - ROVER LAB
;=============================== START =============================
;===================================================================
Pause 500 ; Give Everything Time to Initilize
Init: ; Defining Input & Output Pins.
; PORT A
input A.0 ; Forward Input
input A.1 ; Reverse Input
input A.2 ; Left Input
input A.3 ; Right Input
; PORT B
output B.0 ; Servo 1
output B.1 ; Servo 2
output B.2 ; Servo 3
output B.3 ; Servo 4
output B.4 ; Input 1 on L293D x 2
output B.5 ; Input 2 on L293D x 2
output B.6 ; Input 3 on L293D x 2
output B.7 ; Input 4 on L293D x 2
; PORT C
output C.0 ; Input 1 on L293D x 3
output C.1 ; Input 2 on L293D x 3
output C.2 ; Input 3 on L293D x 3
output C.3 ; Input 4 on L293D x 3
output C.4 ; Input 1 on L293D x 1
output C.5 ; Input 2 on L293D x 1
output C.6 ; Input 3 on L293D x 1
output C.7 ; Input 4 on L293D x 1
Servo B.0,150 ; Init Servo 1
Servo B.1,150 ; Init Servo 2
Servo B.2,150 ; Init Servo 3
Servo B.3,150 ; Init Servo 4
goto ButtonTest
;===================================================================
ButtonTest:
if PinA.0 = 0 AND PinA.1 = 0 AND PinA.2 = 0 AND PinA.3 = 0 then ; If the Forward and Reverse Switch is in the Off Position && Left and Right Switch is in the Off Position.
low C.4 ; Turn all Motors Off
low C.5
low C.6
low C.7
low B.4
low B.5
low B.6
low B.7
low C.0
low C.1
low C.2
low C.3
elseif PinA.0 = 1 AND PinA.2 = 0 AND PinA.3 = 0 then ; If the Forward Switch is in the On Position && Left and Right Switch is in the Off Position.
low C.4 ; Set all Motors to Clockwise.
High C.5
low C.6
High C.7
low B.4
High B.5
low B.6
High B.7
low C.0
High C.1
low C.2
High C.3
elseif PinA.1 = 1 AND PinA.2 = 0 AND PinA.3 = 0 then ; If the Reverse Switch is in the On Position && Left and Right Switch is in the Off Position.
High C.4 ; Set all Motors to Anti - Clockwise.
low C.5
High C.6
low C.7
High B.4
low B.5
High B.6
low B.7
High C.0
low C.1
High C.2
low C.3
elseif PinA.2 = 1 AND PinA.0 = 0 AND PinA.1 = 0 then ; If the Left Switch is in the On Position && Forward and Reverse Switch is in the Off Position.
ServoPos B.0,200 ; Put Outer Wheels in Turning Positions.
ServoPos B.1,100
ServoPos B.2,200
ServoPos B.3,100
High C.4 ; Set all Motors to Anti - Clockwise - Left Rotation.
low C.5
High C.6
low C.7
High B.4
low B.5
High B.6
low B.7
High C.0
low C.1
High C.2
low C.3
elseif PinA.3 = 1 AND PinA.0 = 0 AND PinA.1 = 0 then ; If the Right Switch is in the On Position && Forward and Reverse Switch is in the Off Position.
ServoPos B.0,200 ; Put Outer Wheels in Turning Positions.
ServoPos B.1,100
ServoPos B.2,200
ServoPos B.3,100
low C.4 ; Set all Motors to Clockwise.
High C.5
low C.6
High C.7
low B.4
High B.5
low B.6
High B.7
low C.0
High C.1
low C.2
High C.3
endif
goto ButtonTest
;===================================================================
;=============================== END ===============================
Attachments
-
3.4 KB Views: 12