Shop OBEX P1 Docs P2 Docs Learn Events
I messed up. — Parallax Forums

I messed up.

ERMERM Posts: 34
edited 2005-09-07 16:51 in BASIC Stamp
Sorry about the confusion, I was·in a hurry when I wrote it.· The correct·code is below.· How can I

Led 1:

high 1
pause 50
low 1
pause 50
high 2
pause 50
low 2
pause 50

goto Led 1

and

Led 2:

high 3
pause 50
low 3
pause 50
high 3
pause 50
low 3
pause 50
high 4
pause 50
low 4
pause 50
high 4
pause 50
low 4
pause 50

goto Led 2

How can I do both these programs above at the same time without any interuption.

Any ideas or will I need another chip that can put these commands seperately into the different slots on the EEPROM?· If I need another chip, which one would I need? Thank again in advance.
«1

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-08-23 16:52
    Why did you repost this question? You already have a post asking this exact same question, and other forum members have been helping you with it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-08-23 17:02
    Here is a hint:

    Consider the following-
    0101
    0110
    1001
    1010

    Think of those as states.

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke

    Parallax Tech Support
    rclarke@parallax.com
  • ERMERM Posts: 34
    edited 2005-08-23 17:56
    I didn't repost the same question. My last post had the wrong code on it and I corrected it.
    Everyone was answering a question I asked incorrectly. Then, the answers went off on a tangent.
    I really do appreciate everyone's help, but hint's of states when I don't really understand what a state is doesn't help. I am new at this and some of this is Chinese to me. Plus, I don't think I'm being clear what I am trying to do.

    Is it possible to make one set of led's flash one pattern, while another set flashes another pattern?

    If I put them all in the same loop, one pair will flash first and then the other pair will flash second. Can this be done with code in a BS2 or do I need another BS2(x) chip that can write to the different "slots" on the chip?

    The code I wrote above is two simple patterns, I have a lot more complex patterns I would like to use.

    Thank you for your assistance.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-23 17:59
    Tony,

    ·· I would recommend reading our "What's A Microcontroller?" text, a free download in PDF format from our website.· A link to the page is provided for you.· The link to the download is at the bottom.

    http://www.parallax.com/detail.asp?product_id=28123



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-08-23 18:13
    It's not a tangent if it directly applies to the answer to your question.


    0101
    0110
    1001
    1010

    Look at those numbers. Consider the first bit position 'pin 1' (starting with the least significant place)- the second place as being 'pin 2', the third as 'pin three', the fourth as pin 4.

    The first 0101 would then represent pins 1 and 3 as being 'on'-
    The second line, 0110 represents pins 2 and 3 as being 'on'-
    The third line, 1001 represents pins 4 and 1 as being 'on'-
    The fourth line 1010 represnets pins 4 and 2 as being 'on'-

    Putting pauses between them and looping you have just accomplished your desired LED patterns, as listed in your earlier code.

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke

    Parallax Tech Support
    rclarke@parallax.com
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-08-23 18:45
    Since you are new to electronics design, follow Chris's advice and read WAM, study it, make it your bathroom reading and sleep with it under your pillow. It covers many fundamental topics nessesary to designing BS based projects, flying blind is the best way to create an expensive and ineffective paperweight out of your stamp.

    To touch on what was said in the other post, the stamp is serial in nature, this means it does one and only one thing at a time. There is no way out of this, this is a fundamental aspect of all but the newest microcontrollers. So switching to another platform will not fix this (unless you are prepared to spend $1K+ on a development platform that is capable of this, but this is like trying to drive a nail in the wall with a wrecking ball).

    Placing the two programs in different run slots will not help, the run slots are used to swap out a running program with different program. This is akin to having a computer with Windows and Linux on the machine, you can choose to boot up one or the other, but you cant boot up both at the same time.

    What you need to do is interleave the code, this means that the code for both·flashing sequences·are smashed together into a single program so that each flashing sequence occurs properly. You can either do this by figuring out the flash sequence for each and the pauses between the·flashes, or you can throw the concept out of the window and adopt another scheme. Since you want several different flash schemes its best if you pick the latter. Ryan's suggestion is one example of an alternate approach, known as state design. The states for your proposed interleaved LED flashing is:

    0101
    0000
    0110
    0000
    1001
    0000
    1010
    0000

    the rightmost bit corresponds to your LED on pin 1, the leftmost bit corresponds to the LED on pin 4. If you print out each of your programs and duplicate the first program so there is the same number of toggling of the LEDs (8 total), you'll see the states listed above are equivalent to your code. These codes would be stored in your EEPROM to be read out then written to the pins the LEDs are connected to. There are some further optimizations possible, but I won't go into them because they would probably just confuse you.

    With respect to starting another thread because the other one went off-topic, take control of your threads if you feel the topic is going astray. Just post a message stating "can we get back on topic, I still don't undertsand ____". Also its advisable to just post your corrected code to the original thread. The reason why we harp on this is to avoid polluting the forum. Frequently if I go away for the weekend, I'll come back to three full pages of unread posts. If people post multiple posts this would easily expand to 6-7 pages. If I have that many messages to read, I just skip over large swaths of posts based only on the subject line. Since many members don't use a descriptive subject line (like "Problem with my BOE-Bot" when in fact his question has to do with an IR sensor thats malfunctioning, the subject doesn't really convey the problem they are having), the likelyhood of me skipping over a post that I could have helped the member on greatly increases.

    P.S. didn't you ask this question about a month ago? We aren't hiding any magic bullets from you, the stamp you have today is the same stamp you had then. If our discussion is going over your head, be assertive and ask for clarifications (and be specific on the exact thing you want to be·clarified). People of all different skill levels visit these forums, and as such most of us who provide help try to strike a balance, resulting in talking over some people's heads, while talking down to others. It is your responsibility to get us to further explain a topic you are having difficulty with, we're not mind readers and have no way of knowing what you do or don't understand.

    Please don't read frustration or condecension into any of my words, because those feelings are not behind this post. I am merely trying to help you to interact with us in a way that is most productive to you learning this material.

    Take care,
    Paul

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 8/23/2005 7:08:39 PM GMT
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-08-23 20:26
    Tony, perhaps Jon William's explaination will be more clear to you. He posted a method of state design in this post in the ParallaxEFX forum. The program was written for a Prop-1, which is based on a BS1, so the code may require some modification to get it to work on a BS2, but his explaination is still valid.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-08-24 01:58
    Hey there Tony, please don't be scared off. We do want to help you figure this out. I will goto whatever lengths required to teach this to you. I want your first experiences with embedded programming to be enjoyable and fullfilling. Don't let your lack of knowledge intimidate you out of this persuit, this stuff can be learned by practically anyone if they have enough desire and stick-to-it-tiveness. I promise to try and not come across as harsh anymore, my tendancy to be terse comes across as being severe, but Im not. The next time I have a bit of free time, I'll see if there is any tutorials on state design that are easy to understand. I'll even help you design some code for this now that I have a stamp (I only had the SX until last week, TYC&Plx [noparse]:)[/noparse])

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 8/24/2005 2:03:25 AM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-24 03:35
    Paul,

    ·· You are certainly thorough!··The forum members are certainly lucky to have the added contributions.· And you're welcome!· =)· To that end the forums exist to help the members/customers with their support issues.· Please feel free to ask questions.· Just be prepared to do a little work too!· =)


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • metron9metron9 Posts: 1,100
    edited 2005-08-24 03:37
    So you can't run two programs at the same time but you can simplify the logic of both programs running at the same time and do exactly what would happen if you could run two programs at the same time. Link to picture in case image upload fails [noparse]:http:[/noparse]//www.stickerpub.com/CODE.jpg

    [noparse][[/noparse]code]

    led1
    high 1
    high 3
    pause 50
    low 1
    low 3
    pause 50
    high 2
    high 3
    pause 50
    high 1
    high 4
    pause 50
    low 1
    low 4
    pause 50
    high 2
    high 4
    pause 50
    low 2
    low 4
    pause 50
    goto led1

    Now if you were to change the pause time in any of the lines this method would not work.
    You would also have to have intended to start both programs at the same time for this to work

    But if indeed you want to simulate running both loops at the same time, and start them independently I would be happy to code an example of how to do that. It will take some time and you would need a clock pulse so you could multi thread the code, and I would do it now for an excercise in brain stimulation but I was up till 4 am last night and I should go get some sleep now.

    Sorry if I hijacked your other post but I thought I nailed it down in my first post.
    576 x 504 - 107K
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-08-24 12:09
    metron, your code is the first solution I spoke of in the lengthy post above, thanks for explicitly stating it. But like you say, if any of the parameters change, the code is inflexible and requires rewriting to accomodate other flashing schemes. The state design method Ryan and I have been talking about is a much more versatile method, to change the flash sequence only requires changing the state information stored as data in the EEPROM, additionally you can store many different flash patterns in EEPROM and dynamically switch between them on the fly by accessing the appropriate data stored. Since Tony expressed a desire in this functionality, thats why Ryan and I are trying to teach this method. But your code is an excellent starting point to show that code can be written to simulate simulataneous actions even though the stamp is a single threaded microcontroller.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Tom WalkerTom Walker Posts: 509
    edited 2005-08-24 13:32
    I would think that if you knew the "granularity" of your output events and they fall within the operating parameters (speed) of the target BS, you should be able to set up a routine to load OUTS on your own internal clock. I haven't spun through the details, but this method should allow easy changes to your patterns on each pin. It probably won't allow very "high-speed" patterns due to overhead, but for "blinkies" it should be sufficient.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-08-24 14:57
    Folks -

    Here are some excellent application notes written by Dr. Tracy Allen, about how finite state machine concepts can be used with the Parallax PBASIC Stamp:
    http://www.emesystems.com/BS2fsm.htm

    Certainly not all possible cases are covered, but that should give you a flavor of what finite state machines are, how they work, and how they might apply to PBASIC Stamp programming.

    Regards,

    Bruce Bates
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-08-24 15:26
    Im posting because I dont want to confuse Tony anymore than nessesary, but state machines and state design are not exactly the same. State design is a special case of a state machine, where there are no inputs affecting transition to the next state. I fear if we try to teach him the entire theory of state machines he will get lost in the superfluous information that is applicable to state machines but not state design. Though once state design is understood, it is only a short hop to understanding state machines.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • metron9metron9 Posts: 1,100
    edited 2005-08-24 19:57
    Tony, Do you have any questions to clarify anything that has been written in this thread? Has it answered your question yet?

    I would like to say it is amazing how a seemingly simple question can elicit huge amounts of other concepts about how to do a very simple task. Let me add one more.

    I am new at understanding what "CHIPS" can do and connecting them to the basic stamp so let me ask a question that relates to the software problem listed here and bring it into the hardware relm. Would it not be possible to use a flip flop chip, a 555 timer and a few other pieces of hardware to allow a single threaded bs2 to do the following.

    BS2
    Using 7 output pins
    1 pin data ready pin
    2 pins select led # 0 thru 3
    4 pins represent a number 0 thru 255 'Length of time to light led

    Hardware flip flops timer, transistors and/or whatever else needed hooked to these 7 pins

    When pin 1 goes high, voltage is sent to trigger that opens path to pins 1.2 and pins 3,4,5,6 to select led and charge a capacitor. The charge would represent the 0 thru 255 number for the time the led stays on?

    Like I say, I am new at this but it seems before there was software you would have to do this with only hardware. Now that we have both, should not the discussion include hardware components that take the place of code running on the stamp?

    A simple example would be a circuit thet has a capacitor and 2 pins, charge up capacitor to a voltage by setting pin 2 high for a specific time, then set the pin 0 high to flip a switch that drains the capictor voltage into the led, No need to turn it off as the led will go off when the cap drops below 1.6 volts or so.

    I guess I may be hijacking this post again so if anyone has a complicated circuit design/software interface combo that would do the above it might be wise to set up a new thread that ties it al together. But ignore this post if you think it is not relative to the discussion sometimes it's a grey area for me to decide.
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-08-24 20:43
    The problem here is that you are adding more complexity than necessary. Occam's Razor.

    Adding a 555 involves another IC, wiring, power, etc. PLUS all the supporting hardware, to accomplish a relatively simple task.

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke

    Parallax Tech Support
    rclarke@parallax.com
  • ERMERM Posts: 34
    edited 2005-08-24 20:55
    Thank guys for taking the time to explain things in great detail.· It has been a month since a asked that question, that's because I was away and have just recently settled back into the swing of things and I'm returning to my circuits.· Because others on the forum have mentioned using other chips for different applications, I was wondering if there was a "simple" chip like a pic or another model of a BS2 that could be programmed to suit my needs.· I gues it all has to do with the coding.· Like I said before, I have written about 20 different flash patterns and wanted to cycle between each one with the push of a button.· The distinguishing feature about this setup is that instead of this "Flasher" circuit only flashing one pair of led's, mine would flash multiple pairs of led's, each with it's own user selectable flash pattern.· Sounds complex, but I guess I understand it better because I thought it up.· I think that clarifies it.· Does that help?
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-08-24 21:11
    I think you would be hard pressed finding an external chip (that isn't another microcontroller, but why have a stamp in the equation then?) that is versatile enough to suit your needs. How many LEDs total are you talking about trying to drive? I assume you're talking about 16 or fewer LED channels, though if you need more of that, that can be handled with an additional chip or two. I am confident that your application is solvable with a stamp, with no additional circuitry besides the LEDs, current limiting resistors and your button.

    <edit> btw what version of the stamp are you using? I assume it is a newer one with run slots, since you made reference to using that feature. </edit>

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 8/24/2005 9:13:30 PM GMT
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-08-24 21:54
    I would like to echo what Paul just said. This is a simple setup. Easy to do with just the LEDs and current limiting resistors. You don't need other hardware- the only reason you'd need other hardware is if the number of LEDs was huge. (You'd need power from another source in that case anyway.)

    I would suggest you start simple, and work your way up. After you are comfortable with the concepts then you can start evolving them into more complex solutions.

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke

    Parallax Tech Support
    rclarke@parallax.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-24 22:15
    Tony,

    ·· In the interest of trying a variation on, at least what I think you're trying to do, I just sat down and punched out some code to do different flash patterns on 2 different outputs.· Each flash pattern is taken from a segment in EEPROM.· That in and of itself is not so interesting, but what IS interesting is that since you had a realtively simple task, being that the pauses were the same, my routine was able to switch to a different flash pattern by pressing a button and having a pointer read from another section of EEPROM where the flash pattern was stored.

    ·· To simplify things a bit what is happening in my routine is that there are 3 tables (Currently, though I could add until memory was gone) with different flash patterns.· A pointer is updated to point to an index (offset) of the start of each table as it goes through the sequence.· When the button is pressed, the pointers are changed to point to the next set of tables so now LED one flashes LED pattern 2 and LED 2 flashes pattern 3.··This could be be made to happen differently for each LED.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • ERMERM Posts: 34
    edited 2005-08-25 06:18
    I have the BS2-IC Starter Kit with the Board of Education. The only other number on it is 27203. I am using the BS2 to drive transistors that in turn drive an array of LED's.
    I am trying to build a flasher that can be multiple flashers in one. Right now, on the market, there is only a single user selectable flasher with multiple outputs flashing the same selected pattern. I am trying to make user slectable flash patterns for EACH pair of outputs.
    BTW, the pause times are not all the same, some of my patterns have random pause times for different effects such as below:

    '{$STAMP BS2}

    reps VAR NIB
    BtnWk VAR BYTE

    variablespeeddouble:

    for reps = 1 to 4

    high 1
    pause 100
    low 1
    pause 100
    high 1
    pause 100
    low 1
    pause 100

    BUTTON 0,1,255,250,BtnWk,1,off

    high 2
    pause 100
    low 2
    pause 100
    high 2
    pause 100
    low 2
    pause 100

    NEXT

    for reps = 1 to 4
    high 1
    pause 80
    low 1
    pause 80
    high 1
    pause 80
    low 1
    pause 80

    BUTTON 0,1,255,250,BtnWk,1,off

    high 2
    pause 80
    low 2
    pause 80
    high 2
    pause 80
    low 2
    pause 80
    NEXT

    for reps = 1 to 4
    high 1
    pause 60
    low 1
    pause 60
    high 1
    pause 60
    low 1
    pause 60

    BUTTON 0,1,255,250,BtnWk,1,off

    high 2
    pause 60
    low 2
    pause 60
    high 2
    pause 60
    low 2
    pause 60
    NEXT

    for reps = 1 to 8
    high 1
    pause 40
    low 1
    pause 40
    high 1
    pause 40
    low 1
    pause 40

    BUTTON 0,1,255,250,BtnWk,1,off

    high 2
    pause 40
    low 2
    pause 40
    high 2
    pause 40
    low 2
    pause 40
    NEXT

    for reps = 1 to 4
    high 1
    pause 60
    low 1
    pause 60
    high 1
    pause 60
    low 1
    pause 60

    BUTTON 0,1,255,250,BtnWk,1,off

    high 2
    pause 60
    low 2
    pause 60
    high 2
    pause 60
    low 2
    pause 60
    NEXT

    for reps = 1 to 4
    high 1
    pause 80
    low 1
    pause 80
    high 1
    pause 80
    low 1
    pause 80

    BUTTON 0,1,255,250,BtnWk,1,off

    high 2
    pause 80
    low 2
    pause 80
    high 2
    pause 80
    low 2
    pause 80
    NEXT

    BUTTON 0,1,255,250,BtnWk,1,off

    GOTO variablespeeddouble

    off:
    low 1
    low 2
    BUTTON 0,1,255,250,BtnWk,1,variablespeeddouble
    GOTO off

    Right now the off feature is to be able to turn off the led's while I edit the code and rerun the code.
    I assumed there are slots seeing that when I hit the map feature in the stamp editor, it shows 16 slots. This migh not be true with my stamp.
    As you can see, the code gets somewhat complex with varying pause times and light up sequences. Also, I already have the "What's a microcontroller?" text and read it. I didn't pick up where it said I can't do what I am asking of it to do.
    Anyway, I hope this helps to clarify. Thanks again.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-08-25 14:23
    Ok, the variable timing complicates things abit, are each of those examples run singlely (switched between via the button) or are multiple ones supposed to be run simultaneously, if so how many simultaneous are run at the same time?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-25 14:40
    ·· Jon Williams uses a simple, but effective tasking routine, whereby each series of tasks are executed in a sequential order, essentially dividing the time up amongst the routines equally (Depending on how long each routine takes).

    ·· If you wrote your code much like my example, but broke each pattern section up into a different task then you might still be able to do this, although the results would be dependant on how many different sequences you needed running at the same time, and how often the buttons needed to be checked (The button command would not be useful at all here).

    ·· Two changes to my example would need to be made.· One is you would need to add a delay value byte for each pattern to the EEPROM table, reading in two bytes for each action (This could also be done with less).· The other is that instead of updating the pointers sequentially, you would divide them up into tasks that used counters (inline) to count passes through each task.

    ·· Each task would execute one segment of code and continue, updating it's counter then return to the task switcher.··That way each task could give the illusion of running at different speeds.· I would almost be inclined to try this just to see if it could be done with a reasonable number of LEDs/patterns on a stock BS2.

    ·· To explain what happpens in each task, BTW, it would turn the LED on/off according to it's current position in the EEPROM map for that sequence (Selected) and then increment a counter set by the delay byte.· The sequence counter woudn't update for this task until it's timer counter expired (to 0).· Then it's EEPROM pointer would be incremented and that task would be updated again.

    ·· It's kind of hard to explain, but it means that it would take several passes through each task for one to change states, but they would be able to do so at different intervals, not together.· I think Paul may know what I am getting at.· This stuff is often used in IRQ/ISR routines to allow counters that don't delay the ISR.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-08-25 15:40
    Psst, Chris you didn't include your program in the post describing your example (unless its an embedded hidden link)·smilewinkgrin.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-08-25 16:06
    I would also suggest looking at Jon's sequencer code structure : http://forums.parallax.com/forums/default.aspx?f=22&m=76080

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke

    Parallax Tech Support
    rclarke@parallax.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-25 16:47
    Paul,

    ·· I can do that probably later today (I did that from home), but I am also considering trying to whole kitten kaboodle (sp?) with 8 LEDs and 8 inputs just to see what happens.· We're talking about a lot of tasking going on here.· In the outside loop to break up each individual sequence and inside each sequence section to update the timing/sequence for that routine.· It could be done...The question is performance.· I'm surprised you didn't bang out some code to do this on a BS2px24!· tongue.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-08-25 17:08
    My schedule has been filled to the hilt, this may not be apparent because Ive been spending a few spare minutes here and there answering posts. Last night was particularly frustrating because I had set aside the time to enjoy a good home cooked meal and a movie with my gf. As I was chewing my first bite, the phone rang with a frantic pool league team member begging me to come play because another teammate didn't bother to show up. Two hours later, I returned home to a cold plate of food and my gf sound asleep cry.gif .

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • dandreaedandreae Posts: 1,375
    edited 2005-08-25 17:28
    Paul, Paul, Paul,

    What have we learned from this?· Was it worth it?· Ha! Ha!lol.gif

    Dave

    P.S.· I couldn't resist!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    Http://www.parallax.com

    ·
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-08-25 17:40
    1) Don't answer the phone when you are eating.
    2) Listen to your girlfriend when she says "Let the machine get it".
    3) Have the backbone to say no when asked to do something you truely don't want to do.

    Though I did win my match, which helped my team regain our first place standing (I beat someone 2 skill levels higher than me, the most difficult match I've played all season, I spend 3/4 of my shots playing defense trying to force a "ball in hand" situation (APA rules state if you do not strike your own ball first, resulting in your ball in a pocket or any ball striking a rail, the opponent gets to place the cue ball anywhere on the table)).

    Anyways, this is off topic so I'll stop this tangent now.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-09-03 15:55
    Paul Baker said...
    Psst, Chris you didn't include your program in the post describing your example (unless its an embedded hidden link)·smilewinkgrin.gif
    Paul,

    ·· You are correct, I didn't...My example just used a bunch of patterns stored in DATA statements, and I was hoping to implement the original poster's press a button idea.· But instead I cleaned the code up enough so that you can see easily the variables that set the table pointers and make your own code to switch patterns.·

    ·· This code makes my case clearly I think.· I used my PDB to do this.· I wired P0-P7 to the first 8 LEDs on the board, although I only use 6 in this example.· This code has individual patterns of varying lengths, with the on/off times of each LED totally independant of the others.· Not perfect, but gets the job done, AND on a BS2!· =)

    Comments/Questions are welcome.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.