Let's Make Robots!

blinky

finds his way through places without bumping into anything

here is my robot named blinky. i ordered these parts from @chris the carpenter. he has 4 AAA alkanine batteris, a servo for the head, 2 geared motors, and a few LEDs. please comment on how to operate on a picaxe to make the motors move(by that i mean write down a code that has worked for you) also, @AAronsuper1 helped me.                                   

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

do
	high B.1	; switch on output B.1
	pause 1000	; wait 1 second
	low B.1		; switch off output B.1
	pause 1000	; wait 1 second
   loop			; loop back to start

nice

As TeleFox pointed out in the shout box, manual 3 states:

If you want to Goto ‘jump’ when switch is open:

if pin0 = 1 then jump

If you want to Goto ‘jump’ when switch is closed:

if pin0 = 0 then jump

The one problem I could see you having is you may need to change pin0 to either B.0 or C.0. The newer parts are not as limited in their abilities and therefore you need to specify which pin you are talking about.
Therefore, my suggestion to you is to use either on of the code snippets above and replace pin0 with B.0. If that doesn't do it then replace it with C.0. Get back with us if neither of those work.

Try this stuff out for your motors, tell me what way they move.

 

symbol turn = 300 ' this sets how much should be turned

symbol servo_turn = 700 ' This sets for how long time we should wait for the servo to turn (depending on it´s speed) before we measure distance

 

main:

gosub body_lturn

gosub totalhalt

gosub body_rturn

gosub body_rturn

gosub totalhalt

gosub body_lturn

gosub totalhalt

gosub lturn

pause servo_turn

gosub rturn 

pause servo_turn

gosub rturn

pause servo_turn

gosub nodanger

pause turn

gosub totalhalt

gosub danger

pause turn

gosub totalhalt

 

goto main

 

nodanger:' this should be your combination to make the robot drive forward, these you most likely need to adjust to fit the way you have wired your robots motors

high 5 : high 6 : low 4 : low 7

return

 

danger:

low 5 : low 6 : high 4 : high 7

return

 

body_lturn:

high 6 : low 5 : low 7 : high 4 ' this should be your combination that turns the robot one way

pause turn : gosub totalhalt

return

 

body_rturn:

high 5 : low 6 : low 4 : high 7 ' this should be your combination that turns the robot the other way

pause turn : gosub totalhalt

return

 

rturn:

servo 1, 100 ' look to one side

return

 

mturn:

servo 1, 150

return

 

lturn:

servo 1, 200 ' look to the other side

return

 

totalhalt:

low 4 : low 5 : low 6 : low 7 ' low on all 4 halts the robot!

Servo 1,150 ' face forward

wait 1 ' freeze all for one second

return

Well my man, it looks like you are up and running. It is probably a good time to take a quick second to tidy things up a bit and then keep pushing on. First off, that chassis was designed to go the other way (it is upside down right now). If you flip if over, and put the tail wheel on the other side, it will not only sit level, but you would then have a nice, flat deck to mount all your stuff. This is sorta important because your sensor (once it is attached) is not going to be level. Instead, it will be looking up or down at an angle. --The battery can fit between the motors and thus, be out of the way.

Now, last night we seemed to have an intermittent connection with the batteries that lead to problems syncing any code into the robot. I would take a moment to double check the connections you made between the 2-pin female connector and the leads coming out of the battery holder. Strip the wires, twist them tight and solder if you can. Tape them well or use some shrink tube.

Blinky is really just a fancy Start Here bot. You will be using a Ping instead of a Sharp but really, they are almost the same. It would be wise to read the Start Here post and then read it again. There is a lot of stuff in there that can help get you going. 

Beyond that, you are now at the point where you simply need to start learning how to write code. If you go to the help menu in your picaxe software, you will find (3) PDF's --the manuals. Open them! The first one has a lot of good stuff on getting started, pinouts and a bunch of other good stuff. Manual 2 contains all the commands you would need to use within your code. Each command is explained and an example is given. Manual 2 will be your best friend, read it early and often. You should also look up the PDF manual that goes with the 28x board --Lotta good stuff in there too. 

Also, if and when you get a chance, I would switch to rechargable AA batteries. They are going to be MUCH cheaper in the long run and better for your robot. A alkaline pack of 4 AA's puts out about 6v or so which is technically over what your picaxe really should be using. The picaxe can probably tolerate this voltage, but it would be best not to run at this voltage for a long time. Instead, a 4 AA pack of rechargables puts out around 4.5 -5.2v which is exactly what your picaxe wants to run on.

You have got a lot of stuff to start learning here, but if you got through all the install stuff, you can learn it all, no problem.

Good luck my friend, 
I will be around.