PICAXE-28X1_Proposed_Connections.png (445246Bytes)
Extended_Look_V1.5.bas (3626Bytes)
Simple_Left_Right_V1.5.bas (2813Bytes)
Recently I wrote two programs for a PICAXE-28 microcontroller. Currently I do not have a robot but I am looking for UK suppliers. The first program is based on the Start Here program, whereas the second is an idea of my own which elaborates on my simpler program.
Please note that at the moment values like the danger level (currently 70), servo delays, turn delays and high/low commands are in fact blind guesses as I don't yet have a robot to test them on. Please also note that the programs assume that the left motor is connected at pins 4 and 5, that the right motor is connected at pins 6 and 7, and that there are two LEDs connected at pins 0, 1, 2 and 3.
Simple_Left_Right:
V1.5:
- Main loop is now a Do While statement.
- Bigger if statement for improved decision making.
- The program now assumes that the LEDs are hooked up to an output pin each and the ground pin, reducing the number of
- required pins.
- Halved the ServoDelay for efficiency.
- Split the code up into subroutines for efficiency and also to make the code easier to read.
V1.4:
- Added a servo position reset towards the end of the program.
- Slightly extended the ServoDelay.
V1.3:
- Altered when LEDs are switched on to improve bug-testing.
V1.2:
- Added symbols for pins.
V1.1:
- Added support for down-facing IR sensor. This includes the turn 180° feature.
- Added support for LEDs.
V1.0:
- Looks left and records the distance.
- Looks right and records the distance.
- Works out the greatest distance.
- Turns and travels in that direction.
Extended_Look:
V1.5:
- Main loop is now a Do While statement.
- Bigger if statement for improved decision making.
- The program now assumes that the LEDs are hooked up to an output pin each and the ground pin, reducing the number of required pins.
- Split the code up into subroutines for efficiency and also to make the code easier to read.
V1.4:
- Altered when LEDs are switched on to improve bug-testing.
- Removed accidental Return commands.
V1.3:
- Added symbols for pins.
V1.2:
- Added support for down-facing IR sensor. This includes the turn 180° feature.
- Added support for LEDs.
V1.1 (Is actually just called "Extended_Look_Optimised"):
- Looks approximately 90° left and records the distance.
- Looks approximately 45° left and records the distance.
- Looks approximately 5° left and records the distance.
- Looks approximately 5° right and records the distance.
- Looks approximately 45° right and records the distance.
- Looks approximately 90° right and records the distance.
- Works out the greatest distance.
- Turns and travels in that direction.
The first one - in theory - is fast, but because it only looks in two directions it isn't very accurate. The second one - again in theory - is slower, but because it "sees" more it can make a better informed decision.
Update: 19:37 GMT, 29th April 2012:
Attached is a picture of the planned connections that are used in the programs. I have also removed the old programs and will only be attaching the latest one from now on to avoid confusion. If you would like to view an older version then please don't hesitate to ask. P.S. Appologies for the onslaught of updates lately. I haven't been on here for over a year and I'm trying to get to grips with all of the features again.
Update: 21:14 GMT, 2nd May 2012:
Today I opened a new post. There I will keep you updated on the hardware development of my robot. The software side of things will stay here for now but may eventually move to my robot post as I develop a more suitable program for it. You can access my new post here.
Update: 20:48 GMT, 9th May 2012:
Sorry I haven't updated in a while. I've spent an extra hour or two testing as best I can my programs. I'm still waiting for my second package so my robot still has no eyes. Soon I will try and test some motors so I can get them sorted in my programs as well. I've uploaded another image which shows the big difference between the two programs, and my proposed connections picture has also been updated. Yes, I know they don't match the pins in the programs. I'll fix those when I get everything I need to finish my robot.