Converting 20-X2 Microbot Logicator to PICAXE BASIC (...was Help!)

pleiser

Senior Member
this program for the 20x2 microbot is supposed to turn when it bumps into something and remembre which way it turned and how long it was going in a given direction. when I press the button before it starts it repeats the path again but when I press the button it dose not repeat the path but instead just goes foreward. I started with a flowchart until the decision with bits where I converted it to basic in programming editor and finished the program. any suggestions?
 

Attachments

westaust55

Moderator
I had a look at the .bas file, but at more than 600 lines of code it is exceedingly difficult to follow.
I realise it comes from a conversion from Logicator but it needs changes to the BASIC code version with addition of:
  • meaningful variable names,
  • IO pin definitions (what does each pin do - do you expect folks to have to search the microbot datasheet?, and
  • comments to the purpose of code lines and/or routines to help others read and understand the flow of the code.


At a quick glance, there seem to be blocks of READ and WRITE commands to fixed memory locations and without sufficient comments in the code, it seems as if there may be little capacity to log a series of movements - which may be why it then runs in a straight line in a subsequent run. Nor is it presently easy to quickly ascertain when these blocks of code are in fact called.

In summary, I believe you need to help others understand you code so that they can help you.
 

pleiser

Senior Member
In summary, I believe you need to help others understand you code so that they can help you.
I will post code with comments soon
pins are as follows
B.7 right motor backward
B.6 right motor foreward
B.5 left motor backward
B.4 left motor foreward
B.3 and B.1 led eyes
C.6 push button
C.3 right bumper
C.1 left bumper
ADC8 line tracker
the read and write command are to back up the vairables for power off
p.s. the program is only supposed to remember 8 steps.
 
Last edited:

pleiser

Senior Member
I clarified some of the program and edited the code to make it clearer and the program worked! I labeled on the code what I changed.
 

Attachments

westaust55

Moderator
Great to read that you now have the program working.
A moral here might be that making one's program readable helps everyone (from the writer to those who read later or help).
Good luck with your ongoing project and feel free to post a question on any further PICAXE related problems.
 
Top