Let's Make Robots!

having problems with picaxe board

i just started with picaxe and i need help. i try inserting the code but it says hardware not found every time i try doing a code. the USB cable is plugged in al the way, and all of the wires are in the right way. the code is made by aaron super  :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

is it a good code? what is wrong?forgot to mention i have a mac.  one more quick question, should i insert batts at the same time programing?(when its in the cable and bieng givin the code)

Comment viewing options

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

sorry, Andygadget, but i have a new problem. chek mt lates forum topic

main:

high 0
pause 1000
low 0
pause 1000

goto main

 

I use the Windows 7 PICAXE Programming Editor.  If yours is close, left click on the OPTION button.

A OPTIONS popup window should appear.  Select the MODE tab then select your PICAXE chip from the pull down list.

Then select the SERIAL PORT tab.  One of the COM ports should have AXE027 PICAXE USB next to it.  Select that on then the OK button.

You must of course then have your board connected to the USB cable.

I don't know if anyone mentioned this but you must also have your board connected to the 5 volt battery pack.  If its not connected to the batteries its not "on".

 

          -Hal

 

David,  the 'hardware not found' message is nothing to do with the program itself.  It shows a failure to communicate between the computer and the Picaxe chip.  Would you please just clarify . . . Is this an AXE020 project board and are you using an AXE027 cable to connect it to the computer?  Also, what are you powering the board from and do you have a multimeter?  Finally, What are you running the Programming Editor on?  (I am only familiar with the PC Windows version.)

David, are you still around???

I know Chris helped you to get the drivers installed some time ago but your setup is now failing at the next stage.  The program (any program) will not download until you've got it sorted.  If it is an AXE020 PCB, the little black link shoud be shorting the 2 pins nearest the push-button, and yes, power to the board should be on.

There are people here willing to help you but we can't help unless we get some feedback from you.

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

 

' This sets for how long time we should wait for the servo to turn

' (depending on it´s speed) before we measure distance

symbol servo_turn = 700

 

main:

                gosub body_lturn

                gosub body_rturn

                gosub body_rturn

                gosub body_lturn

                gosub lturn

                gosub rturn

                gosub mturn

                gosub nodanger

                gosub totalhalt

                gosub danger

                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

                pause turn

return

 

danger:

                low 5 : low 6 : high 4 : high 7

                pause turn

return

 

body_lturn:

                ' this should be your combination that turns the robot one way

                high 6 : low 5 : low 7 : high 4

                pause turn : gosub totalhalt

return

 

body_rturn:

                ' this should be your combination that turns the robot the other way

                high 5 : low 6 : low 4 : high 7

                pause turn : gosub totalhalt

return

 

rturn:

                servo 1, 100 ' look to one side

                pause servo_turn

return

 

mturn:

                servo 1, 150 ' look ahead

                pause servo_turn

return

 

lturn:

                servo 1, 200 ' look to the other side

                pause servo_turn

return

 

totalhalt:

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

                Servo 1,150 ' look ahead

                wait 1 ' freeze all for one second

return

 

I moved the pauses into the subroutines. One point, I hope you already know this. You don't read anything from any sensors, so, all you can do with this program is drive around a bit.