BOE-Bot Line Maze Program; How to run Program A or Program B
RoboticsProfessor
Posts: 54
A line maze robot takes two runs through the maze. One to take all the turns and find the end while "deleting" or correcting all bad turns. On the second run the robot now knows the shortest path, so can use the stored path to complete the maze most efficiently.
Several issues:
1. I tried putting both programs together.
-Load 0 in EEPROM location 0 on download of a small "set EEPROM, byte 0 to zero" program.
-Robot starts by reading EEPROM. Zero means this is first path, any positive integer means this is pass 2.
-When robot completes the maze on pass 1, store the best-path in EEPROM, with location 0 containing the number of turns in the final path.
- Second time through, the stored path is used unstead of a left-hand rule.
I'm annoyed that every time I load the program, it starts running. Sometimes the LEDs even hit the "end of maze" combination before I can place it in the maze.
I have room on the protoboard for two switches.
Can't I just wire the two switches to two ports (say 5 & 6) and do this?
start:
...if pin5 = 1 then goto programA
...if pin6 = 1 then goto programB
goto start
programA:
'code to traverse the maze the first time.
end
programB
'Code to read the best path from EEPROM
end
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard Vannoy
Programming and Electronics Instructor
www.PICRobots.com
www.SailingStrategy.info
www.TeachingTechnicalTraders.com
·
Several issues:
1. I tried putting both programs together.
-Load 0 in EEPROM location 0 on download of a small "set EEPROM, byte 0 to zero" program.
-Robot starts by reading EEPROM. Zero means this is first path, any positive integer means this is pass 2.
-When robot completes the maze on pass 1, store the best-path in EEPROM, with location 0 containing the number of turns in the final path.
- Second time through, the stored path is used unstead of a left-hand rule.
I'm annoyed that every time I load the program, it starts running. Sometimes the LEDs even hit the "end of maze" combination before I can place it in the maze.
I have room on the protoboard for two switches.
Can't I just wire the two switches to two ports (say 5 & 6) and do this?
start:
...if pin5 = 1 then goto programA
...if pin6 = 1 then goto programB
goto start
programA:
'code to traverse the maze the first time.
end
programB
'Code to read the best path from EEPROM
end
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard Vannoy
Programming and Electronics Instructor
www.PICRobots.com
www.SailingStrategy.info
www.TeachingTechnicalTraders.com
·
Comments
Are You useing editor vers.2.2 or vers.2.4 ??????
_____________________________________________$WMc%__________________________????__
To: $WMc%: I'm using 2.4.
By the way...
The full working source is at:
http://picrobots.com/my-line-maze.php
With a video of it working here:
http://www.youtube.com/watch?v=raEQlDq_EwI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard Vannoy
Programming and Electronics Instructor
www.PICRobots.com
www.SailingStrategy.info
www.TeachingTechnicalTraders.com
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
So, I guess I missunderstood. What are you asking? The switching that you show would work fine. If you want to drop it down to one pin, you can have the switch be pressed down for a short time or a long time.
I dunno -- "what if"?·
If a robot is on but not running the maze, idle...·then·it's smoking batteries on company time and should be fired.· I figured it was a decision for·A or B.· If a "Go"·switch is required, then groove on.· A/B_switch, Go/Nogo_switch; 6 of these, a half-dozen of those.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
My options seemed to be:
(Simplest) Button A begins the "search maze for the first time" subroutine.
Button B begins the "Go read the stored "best path" for the maze from EEPROM and follow that.
(Or...)Only one button. If EEPROM location zero has a zero, then search first time. If EEPROM location zero is any positive integer, then a path has been stored so go to "best path".
I thought of running the USB from a laptop and put the laptop on/next to the start of the maze, but then the robot takes off before I can get the USB cable unplugged.
So, although it is only for a few seconds, I don't see how else to have the program wait until started by a button.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard Vannoy
Programming and Electronics Instructor
www.PICRobots.com
www.SailingStrategy.info
www.TeachingTechnicalTraders.com
·
Richard Vannoy
Programming and Electronics Instructor
www.PICRobots.com
www.SailingStrategy.info
www.TeachingTechnicalTraders.com
·
· IF Go_NoGo = 0 THEN Idle·· 'pushbutton
A_or_B:····················· 'looks at AorB sel.
· PAUSE 2000·················'change if you need more·setup time
· IF AorB = 1 THEN Program_B
Program_A:
·(subroutine)
·should "end" with END or GOTO Idle
Program_B:
·(subroutine)
·should "end" with END or GOTO Idle