Programming Start Here robot

On the start here robot page, there is a program that has been written up to use with the robot. I copied the program into the programming editor (not via copy and paste because I know that can cause issues in itself) and I uploaded it to my robot. 

Here's the problem: my robot looks around, and then moves backward. It will do this repeatedly. I've already checked to make sure I didn't copy it down wrong. I don't know how to fix the program because I don't know how to program.

I know this is probably a simple fix but any suggestions would be awesome, thanks. :)

 

I believe the page you are referring to had some simple programs

to start with that would help you make sure your robot was going to behave as you expected. I am pretty sure there is a short bit of code that was written to make sure that select motor pins will cause the robot to move forward when commanded as well as backwards when commanded.

I am only guessing, but, it sounds like you have a few options. In no particular order:

  1. You can simply swap the power and ground to both of the motors. 
  2. You can actually run the test code to make sure things are functioning properly.
  3. You can learn a bit about programming so you can edit the code you have used.

 

I might suggest you learn a bit about programming your PICAXE before you jump in to trying to get a robot to move around.

  1. Grab a LED and a 1k resistor. Connect the LED/resistor combo between an analog output and ground. 
    Make the LED blink once a second. Learn to vary the ON/OFF time of the LED.
  2. Add a switch between a digital input and ground.


Rather than me telling you what to do. Why not look over manual 3 and try connecting some of the listed components and seeing if you can get them to work. I am pretty sure, that even with the robot constructed as the page shows, there are enough left over pins that you can try out some of the components. You could even attempt looking over some arduino tutorials for ideas on what components for a newb to try working with. (I use newb with respect in this case.)

You will see a number of members telling new people that want to just build the robot and use someone elses program to make it move. Many times they will be told that copy and pasting code to make their robot move will likely not work or not work as well as it could. Too many real world variables will affect how things work. Looking over someones code to see if you can understand how it works is one thing. “Copy and pasting” code because you don’t know how to program is a whole different story.

Sorry if my reply seems like a rant. It is not meant as such. I am sincerely trying to help you.

Reply

Your reply doesn’t seem like a rant, so don’t worry about that.

My reply to your answers:

1.  I did swap the power and ground to both motors. Now my robot is moving forward. However, I placed the robot on the floor with a box a little ways in front of it. My robot eventually saw the box, but couldn’t turn away from it; my robot backed away from the box, nd then continued moving forward. So either my robot can’t evaluate distance the way it needs to, or my robot is unable to turn. 

2.  If I wanted to run the test code, would press ‘simulate’ in the programming editor?

3.  I’m going to try to find a website that teaches Basic programming so I can try to edit the code to work properly.

 By the way, I like your answer because your telling me I should learn more about how to program my robot instead of copying and pasting something. With that I mean you’re not just telling me a simple fix now, you seem to be encouraging me to learn more so I can not only fix a problem now but, using my own knowledge, so I can use to fix another problem later.

Let me see if I can confuse you some more. :stuck_out_tongue:

First up, I mentioned Manual 3 . The link is what I was talking about.

Sharp IR sensors have a minimum distance they can sense after which the sensor responses start to invert. https://www.robotshop.com/letsmakerobots/node/31733 It still seems like there might be some issues with your code. The 4th PICAXE manual now covers flowcharting. There are a number of ways to help programmers write code. Psuedo code and flowcharting are two common ways that are taught in intro programming courses. I prefer flowcharting. Just my opinion.

To run test code you would actually load it in to the microcontroller and run it there. I scanned the page for the SHR. Starting at Break out, software and then on to Programming. You start getting heads up on testing before actually writing the program to move your robot.