boe bot project
Hi· I need someone to give me some suggestions on a new project with leds on boe bot.· I am making a 2 signal stop ·light and having a brain block getttin started.· I need some clarifications on the wiring and some help with I am thinking· a case select but not quite sure.
Ayone interested?
thanks
Sharon
Ayone interested?
thanks
Sharon
PDF
![](/plugins/FileUpload/images/file.png)
687K
Comments
My favorite coding form for a state machine is to use a select-case block inside an infinite loop. I number each case and use an integer valued variable (say "state_variable") in the select statement to determine which state the state machine is running in. Each state then contains code to make sure any outputs are correct for the current state followed by code that checks to see if any of the exit conditions for the current state have been satisfied. If any state exit conditions have been satisfied the "state_variable" is assigned the number of the destination state. Timing and delays are usually done by adding some timer/clock code to the main loop that is monitored/controlled by each state.
Lawson
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Lunch cures all problems! have you had lunch?
What we can do here is answer questions and clarify what you understand or don't understand, but you're going to have to be specific about what you ask.
As with any project, you start with what you know. You might as well start with a description of how you have things connected (or would connect things). If you haven't been working with them already, you need copies (downloaded or paper) of "What's a Microcontroller?" and the "BASIC Stamp Syntax and Reference Manual". These will show you how to connect switches and LEDs to a Stamp and will serve as a reference for PBasic.
You have two modes of operation. How about starting with the simplest mode where the lights flash. How fast? Do they alternate or flash together? Can you come up with a test program that doesn't involve the switches and just flashes the lights?
sharon
I'm trying to get you to build your program in pieces starting with the simple part.
If you're supposed to model your program somehow on something you've done before and you want help with the process, you'll need to post your program. Use the Attachment Manager that you get with the Post Reply forum button.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
Post Edited ($WMc%) : 12/6/2009 4:18:08 PM GMT
Your program would go through the various sequences. One question for you is whether your system can wait until the end of a sequence before testing the switches or whether it has to interrupt a sequence to change to the other one.
You can use a CASE statement, but you only have two switches and only three different cases (including off). It's simpler using IF statements unless you have to use a CASE to demonstrate its use.
If you have to be able to interrupt a sequence, then your software design has to be different.
Like I said, you're better off sticking with IF / THEN / ELSE / ENDIF statements for your simple problem.
On the bottom of page 3 is the usual connection diagram. Use that as a guide for hooking it up. Try the test programs in the chapter from "What's a Microcontroller?" to see if you can light up a single LED when a switch is closed.
I'm a strong believer in starting small, making sure one thing works as expected before moving on to something more complicated. It may seem to be a waste of time, but, if you look at the overall time it takes to get a project to work, the "step at a time" method usually saves overall time.
Post Edited (Mike Green) : 12/6/2009 9:57:39 PM GMT