Shop OBEX P1 Docs P2 Docs Learn Events
Signature Drink Fountain — Parallax Forums

Signature Drink Fountain

adelatoaadelatoa Posts: 11
edited 2010-07-12 23:25 in BASIC Stamp
Hi guys. I am a designer that loves to think to be an engineer and I have fallen a bit stuck to a few code issues. I've never taken any programing classes and the little things I know in programing were from an architectural class that I took in college that involved using basic stamps and we learned very basic commands. Much of my tutoring has come from reading some of the great posts on this forums. Background aside here is a bit of the project.

My fiance and I are gearing up for our wedding and in the process we come up with a concept Signature drink fountain bar for our guest. The signature drink will be mixed and then added to the two cylinders which will be choreographed by 28 nozzles misting C02 into the signature drinks we will be adding. The following is a concept sketch:

Image-4936703-104288268-2-WebSmall_0_7c275819aac9366c470a1131a556712b_1

Frame/chassis:
Image-4936703-104288275-2-WebSmall_0_60399b47e822edee6d6e8d604112c671_1

Relays/Valves/Nozzles:
Image-4936703-104288299-2-WebSmall_0_7f6b72ea13f6b82b734c1e0f1ce58d84_1

Now I have made a short video where the two BS2's are programmed individually (They are NOT talking/listening to each other) and simply just have been timed to look like they are actually choreographing together. I made this video so you guys can see what I want my vision to be.

Video:
adelatoa.phanfare.com/4653707

The vision is that I would like the two basic stamps to work in harmony "talking/listening" to each other to master a choreography together. I want to write "sub-routines" that can be used to make an entire show but at the moment I have come across my first road-block.

Rooadblock:
I cannot get the second stamp to stop and "listen" and wait for the signal from the first stamp (I have not connected any wires between the two stamps yet and I just want to get my codes right first) and it jumps and performs the "chase" sequence of the code. It's ignoring the Start: IF...THEN command and jumping to the performing the next command which is the "chase". What is wrong with my code?

Second question is in regards to the wiring. On the first stamp my output is PINOUT #15 and in the second stamp PinIN is #14. Do I just link them with one wire this way? Do I need a resistor on the second stamp on pinin #14?

Hope you guys can help as the wedding is nearing by and I know programing is probably going to take longer than what it took to build this thing.

Thanks and lost/STUCK in Los Angeles,

Abel

THE TWO BASIC STAMP PROGRAMING CODES

' {$STAMP BS2}
' {$PBASIC 2.5}
'(7/7/10)

'Choreography stamp

'Pin to send signal to second stamp LOW 15

main:
HIGH 0
PAUSE 500
LOW 0

HIGH 1
PAUSE 500
LOW 1
PAUSE 2000

LOW 15
END


<<<<<<<<<<<<<<<<<<<<<<oooooooooooooooooo>>>>>>>>>>>>>>>>>>>>>>>>>>>>

' {$STAMP BS2}
' {$pbasic 2.5}

'(7/7/10)
'SECOND STAMP AWAITS SIGNAL FROM FIRST "CHOREOGRAPHY STAMP" TO PERFORM ITS ROUTINE

'input from first "CHOREOGRAPHY STAMP" INPUT 14

Main: 'this "main:" command is to signal to me that this second stamp is online AND ready
HIGH 1 'nozzle #1
PAUSE 100
LOW 1
PAUSE 50

HIGH 2 'nozzle #2
PAUSE 200
LOW 2
PAUSE 50
GOTO start

start: 'awaiting signal from first stamp
IF (IN14 = 1) THEN
GOSUB Chase
ENDIF

Chase: 'main choreography of nozzles #11-7
HIGH 11 'nozzle #11
PAUSE 100
LOW 11
PAUSE 50

HIGH 10 'nozzle #10
PAUSE 100
LOW 10
PAUSE 50

HIGH 9 'nozzle #9
PAUSE 100
LOW 9
PAUSE 50
'nozzle #8
HIGH 8
PAUSE 100
LOW 8

HIGH 7 'nozzle #7
PAUSE 100
LOW 7
GOTO start

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2010-07-09 01:11
    Set up the start: routine of the second Stamp using something like:

    Do Until IN14=1
    Gosub Chase
    Loop

    The program will wait at that point until the first stamp sends it a signal on IN14.

    You'll have two connections between the stamps: the pin to pin connection plus a connection between ground (0 volts) on the two stamps.

    More detail in the helpfile of the programming software.

    Off topic, sounds like an AWFUL lot of work for a wedding!

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • skylightskylight Posts: 1,915
    edited 2010-07-09 19:23
    To wait at start till IN14=1:
    start: 'awaiting signal from first stamp
    IF (IN14 = 1) THEN
    GOSUB Chase
    IF (IN14=0) THEN
    Gosub start
    ENDIF
    ENDIF


    This will only go to Chase when stamp 1 sends the signal

    Of course nothing will happen until IN14=1, is that what you want
    or do you want it doing something else until stamp 1 sends the signal?

    Post Edited (skylight) : 7/9/2010 7:30:03 PM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-07-10 00:59
    adelatoa said...
    My fiance and I are gearing up for our wedding and in the process we come up with a concept Signature drink fountain bar for our guest.
    stamptrol said...
    Off topic, sounds like an AWFUL lot of work for a wedding!
    Especially for just one guest! smile.gif

    -Phil
  • sumdawgysumdawgy Posts: 167
    edited 2010-07-10 03:15
    adelatoa said...

    Rooadblock:
    I cannot get the second stamp to stop and "listen" and wait for the signal from the first stamp (I have not connected any wires between the two stamps yet and I just want to get my codes right first) and it jumps and performs the "chase" sequence of the code. It's ignoring the Start: IF...THEN command and jumping to the performing the next command which is the "chase". What is wrong with my code?

    Second question is in regards to the wiring. On the first stamp my output is PINOUT #15 and in the second stamp PinIN is #14. Do I just link them with one wire this way? Do I need a resistor on the second stamp on pinin #14?

    <<massive snippage down to code for bs2 #2>>
    Main: 'this "main:" command is to signal to me that this second stamp is online AND ready
    HIGH 1 'nozzle #1
    PAUSE 100
    LOW 1
    PAUSE 50

    HIGH 2 'nozzle #2
    PAUSE 200
    LOW 2
    PAUSE 50
    GOTO start··· <
    Bookmark A

    start: 'awaiting signal from first stamp
    IF (IN14 = 1) THEN
    GOSUB Chase
    ENDIF· <
    Bookmark B

    Chase: 'main choreography of nozzles #11-7
    HIGH 11 'nozzle #11
    PAUSE 100
    LOW 11
    PAUSE 50

    HIGH 10 'nozzle #10
    PAUSE 100
    LOW 10
    PAUSE 50

    HIGH 9 'nozzle #9
    PAUSE 100
    LOW 9
    PAUSE 50
    'nozzle #8
    HIGH 8
    PAUSE 100
    LOW 8

    HIGH 7 'nozzle #7
    PAUSE 100
    LOW 7
    GOTO start
    Just a couple of points....
    ----Resistor?· Nah. That is.....as long as you keep p14 an input.
    ----The gosub is not needed .... cause you don't· "return"·instead, you use a goto start.
    >>If it was working right, the gosub will cause a crash after·too many gosubs w/o returns·anyway...<<

    And (bookmark A)·as·your code is written,·that 'goto' isn't needed as main drops into start anyway.
    (unless you didn't post a part of code that was·in-between.)

    Speaking of dropping down.....(bookmark B)
    After you checked for p14 high... you let it "drop down" the code into 'chase' anyway.
    (That's why it never waited.)

    Simplest fix is to hop back up to Start if p14 is low.

    So....
    start: 'awaiting signal from first stamp
    IF (IN14 = 0) THEN
    ···· Goto start
    ENDIF
    goto chase 'optional··the way you've displayed code..it falls into chase.

    That's all you'll need!·
    when pin14 goes high it will stop running back to start and fall into chase.
    After chase runs.....back to the loop smile.gif !

    As a personal preference here.......I· prefer

    start: 'awaiting signal from first stamp
    on in14 goto start,chase················ ·'zero--goto start· one---goto chase
    goto chase ' don't need it anymore!

    with·the "on ... goto"· you get a bit more control (over accidental errors)!!
    since you fill in the blanks it's more likely you'd catch a "mis-send" even at· shocked.gif 2am
    AND...it's a one-liner!

    That said....sweet ride...uh...project!!
    (It's always that one little·thing that snags the rest!)


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Before you criticize someone, walk a mile in his shoes. That way if he gets angry, he'll be a mile away and barefoot. - unknown

    Post Edited (sumdawgy) : 7/10/2010 11:44:37 PM GMT
  • sumdawgysumdawgy Posts: 167
    edited 2010-07-10 23:48
    one other comment ... IF program space is at issue..

    the "if then" uses 16 blocks of Eeprom
    while, the on goto uses 8 blocks (well it indicates 10 but 2 of those are "00" so......)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Before you criticize someone, walk a mile in his shoes. That way if he gets angry, he'll be a mile away and barefoot. - unknown
  • FrohmanFrohman Posts: 10
    edited 2010-07-12 23:25
    Ur input statements are commented out so they won't get executed...
    example:
    'input from first "CHOREOGRAPHY STAMP" INPUT 14
    


    examples of what it should look like:
    INPUT 14 'input from first "CHOREOGRAPHY STAMP"
    


    INPUT 14 
    'input from first "CHOREOGRAPHY STAMP"
    


    'input from first "CHOREOGRAPHY STAMP"
     INPUT 14
    



    it would also be much simpler if you used TTL to have your stamps communicate

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    MAGGOTS!

    Post Edited (Frohman) : 7/13/2010 2:14:03 AM GMT
Sign In or Register to comment.