Simple I/O w/ Stamp and Macromedia Director
Hi Everyone,
I am trying to do something seemingly basic that I need some advice
on. I am trying to setup 8 inputs and 6 outputs (extra 2 pins being
used for Serial) on the Stamp to work with Director.
What I want is that when I throw a switch (or push a pushbutton)
connected to my Stamp, Director will know it and do something.
I also want Director to be able to send data to the Stamp and turn
LEDs on.
I want all this to happen real-time. If Director turns something on
and a switch is thrown at about the same time I want both events to
happen. I can figure out the code specifics, but it's more the
pseudo-code, flow of the programs that I can't figure out.
How should my programs look on both ends? Do I poll all the inputs
at once and continually send them to Director? Do I only send them
on request? (Remember I want Director to get it as it happens).
Should the Stamp wait in a loop waiting for output commands from
director? Will this work on the Stamp end?
Loop:
1. Use SERIN to check for input
2. Use SEROUT to send status of all inputs
3. Go to Loop
Will this catch everything? Or is there a better way?
On the Director end: do I create a similar type loop?
Loop:
1. Read inputs
2. Check for event to for sending to Stamp (and send if TRUE)
2. Go to Loop
What do you all think? My main concern is that in these loops,
button pushes and data will get lost.
Is there a better way?! I'm decent at code, but I haven't
programmed a whole lot with Stamps or Director... so I could be not
using a really good function or something..
THANKS
-Josh
I am trying to do something seemingly basic that I need some advice
on. I am trying to setup 8 inputs and 6 outputs (extra 2 pins being
used for Serial) on the Stamp to work with Director.
What I want is that when I throw a switch (or push a pushbutton)
connected to my Stamp, Director will know it and do something.
I also want Director to be able to send data to the Stamp and turn
LEDs on.
I want all this to happen real-time. If Director turns something on
and a switch is thrown at about the same time I want both events to
happen. I can figure out the code specifics, but it's more the
pseudo-code, flow of the programs that I can't figure out.
How should my programs look on both ends? Do I poll all the inputs
at once and continually send them to Director? Do I only send them
on request? (Remember I want Director to get it as it happens).
Should the Stamp wait in a loop waiting for output commands from
director? Will this work on the Stamp end?
Loop:
1. Use SERIN to check for input
2. Use SEROUT to send status of all inputs
3. Go to Loop
Will this catch everything? Or is there a better way?
On the Director end: do I create a similar type loop?
Loop:
1. Read inputs
2. Check for event to for sending to Stamp (and send if TRUE)
2. Go to Loop
What do you all think? My main concern is that in these loops,
button pushes and data will get lost.
Is there a better way?! I'm decent at code, but I haven't
programmed a whole lot with Stamps or Director... so I could be not
using a really good function or something..
THANKS
-Josh
Comments
don't miss any of your real-time messages. Here's a link to how to do
it with VB -- if you know the Director side of things then it should be
helpful.
http://www.parallax.com/dl/docs/cols/nv/vol3/col/nv89.pdf
You can use the 74HC165 to grab eight inputs with just three BASIC Stamp
pins; this will make-up for the loss of pins for serial flow control.
Checkout the 74HC595 if you need to expand your outputs.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: Josh Polk [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=0nZMb4tvdFLYp9LTU9wgwRp_mghzf4utexiLBmdgejax0z0Ub0vXs12B3cdtiWI-YPMgdjd4Mh6vAa0yVgA]mcstampfunk3@y...[/url
Sent: Thursday, March 25, 2004 3:42 PM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Simple I/O w/ Stamp and Macromedia Director
Hi Everyone,
I am trying to do something seemingly basic that I need some advice
on. I am trying to setup 8 inputs and 6 outputs (extra 2 pins being
used for Serial) on the Stamp to work with Director.
What I want is that when I throw a switch (or push a pushbutton)
connected to my Stamp, Director will know it and do something.
I also want Director to be able to send data to the Stamp and turn
LEDs on.
I want all this to happen real-time. If Director turns something on
and a switch is thrown at about the same time I want both events to
happen. I can figure out the code specifics, but it's more the
pseudo-code, flow of the programs that I can't figure out.
How should my programs look on both ends? Do I poll all the inputs
at once and continually send them to Director? Do I only send them
on request? (Remember I want Director to get it as it happens).
Should the Stamp wait in a loop waiting for output commands from
director? Will this work on the Stamp end?
Loop:
1. Use SERIN to check for input
2. Use SEROUT to send status of all inputs
3. Go to Loop
Will this catch everything? Or is there a better way?
On the Director end: do I create a similar type loop?
Loop:
1. Read inputs
2. Check for event to for sending to Stamp (and send if TRUE)
2. Go to Loop
What do you all think? My main concern is that in these loops,
button pushes and data will get lost.
Is there a better way?! I'm decent at code, but I haven't
programmed a whole lot with Stamps or Director... so I could be not
using a really good function or something..
THANKS
-Josh
I've seen a few art pieces that have done this.
Usually what happens is that the artist used a USB
joystick hooked into the computer and the stamp was
wired into the controller. This way, when the stamp
read that a button was pushed, it would trip a Relay
that would then activate the button on the controller.
Director was programmed to recognize the buttons on
the controller. It sounds lo-tek, and it is, but its
not too hard to pull off.
Hope that helps,
Mike
--- Josh Polk <mcstampfunk3@y...> wrote:
> Hi Everyone,
>
> I am trying to do something seemingly basic that I
> need some advice
> on. I am trying to setup 8 inputs and 6 outputs
> (extra 2 pins being
> used for Serial) on the Stamp to work with Director.
>
>
> What I want is that when I throw a switch (or push a
> pushbutton)
> connected to my Stamp, Director will know it and do
> something.
>
> I also want Director to be able to send data to the
> Stamp and turn
> LEDs on.
>
> I want all this to happen real-time. If Director
> turns something on
> and a switch is thrown at about the same time I want
> both events to
> happen. I can figure out the code specifics, but
> it's more the
> pseudo-code, flow of the programs that I can't
> figure out.
>
> How should my programs look on both ends? Do I poll
> all the inputs
> at once and continually send them to Director? Do I
> only send them
> on request? (Remember I want Director to get it as
> it happens).
> Should the Stamp wait in a loop waiting for output
> commands from
> director? Will this work on the Stamp end?
> Loop:
> 1. Use SERIN to check for input
> 2. Use SEROUT to send status of all inputs
> 3. Go to Loop
>
> Will this catch everything? Or is there a better
> way?
>
> On the Director end: do I create a similar type
> loop?
> Loop:
> 1. Read inputs
> 2. Check for event to for sending to Stamp (and
> send if TRUE)
> 2. Go to Loop
>
> What do you all think? My main concern is that in
> these loops,
> button pushes and data will get lost.
>
> Is there a better way?! I'm decent at code, but I
> haven't
> programmed a whole lot with Stamps or Director... so
> I could be not
> using a really good function or something..
>
> THANKS
>
> -Josh
>
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed.
> Text in the Subject and Body of the message will be
> ignored.
>
> Yahoo! Groups Links
>
>
> basicstamps-unsubscribe@yahoogroups.com
>
>
>
__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html