Getting Basic Stamp and Macromedia Flash to talk to each other
Paul Hoover
Posts: 15
I'm trying to get a Basic Stamp accelerometer to talk to Flash to prototype some ideas.· What I've found out so far is that I can get Basic Stamp to talk to a debug window, and I need to get Flash to connect to some socket server that I probrably need to set up.· Other than that, I don't know where to start.· Anyone done this before or know how?
Paul
Paul
Comments
You might want to check on Adobe's Flash forum to see if anybody has instructions for doing so.
I don't know for sure that you can integrate flash into a VB app, but I would be very surprised if you couldn't, since VB interfaces with just about everthing.
-Roger
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Roger Pierson
Senior Electronics Technicain
DTI Assoicates
http://people.interaction-ivrea.it/h.barragan/flashserialinterface.html
·
Instructions:
For use with at least a BS2 and a PC with .NET 2.0 [noparse][[/noparse]you can open the *.swf file in Internet Explorer if you do not have Flash installed].
1.· Program BS2 with serialIO_simple.bs2
2.· Launch Socket2SerialServer.exe...if you get a warning it is because we are opening a socket, not doing anything nasty.
3.· Press the help button and follow the directions [noparse][[/noparse]the default settings should be fine].
4.· Launch CONNECT.swf
5.· Press the connect button.
6.· Press reset on the BS2 and you should see a stream of [noparse][[/noparse]ascii] numbers appear in the Rx box.
7.· Use this framework for further development.· Note the function handleIncoming(messageObj) in CONNECT.fla. This is where you'll do most of the work.
8.· Sorry, but the socket2serial.server application will only work until December 15, 2006.· And if you close the socket connection you will likely need to restart the application.· Ocassionally the thread doesn't die, I'm working on that bit.· Kill it in task manager.
On the Stamp side...
' {$STAMP BS2}
' {$PBASIC 2.5}
loopCount VAR word
FOR loopCount = 0 TO 1024
SEROUT 16, 84, [noparse][[/noparse]DEC4 loopCount] '9600 baud through proto board serial connection
PAUSE 250
NEXT
END
And on the Flash side [noparse][[/noparse]in the posted code]
// received message handler
function handleIncoming(messageObj) {
trace(messageObj.toString());
_root.Rx += messageObj.toString();
var inValue:Number = parseInt(messageObj);//this is where we parse out the value
}
http://www.hcilab.org/documents/ProjectThesis002-IntegratingSensorDataintoFlashMX2004.pdf
Roger- I've worked with the VB.Net Flash Object, and it only can't really interact with the flash movie, only do stuff like pause, play, stop, change movie, and stuff outside of it. It isn't good for interacting with the movie, and feeding it data and such.
-ACfishing
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Has anyone solved this problem before?
Thanks.
Sharon.
-ACfishing
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (A.C. fishing) : 12/1/2006 11:15:44 PM GMT
The USB2SER uses the FTDI chips [noparse][[/noparse]see the documentation on the device]. The FTDI driver that you install when using this device creates a virtual com port [noparse][[/noparse]VCP] when the USB2SER is plugged in.
Have you installed the drivers for the Mac?
The Parallax page for the drivers [noparse][[/noparse]http://www.parallax.com/html_pages/downloads/software/ftdi_drivers.asp] list that the directions are for Windows NT/2000/XP only.
However, you may be able to get the VCP Mac drivers from [noparse][[/noparse]http://www.ftdichip.com/Drivers/VCP.htm].
Flash [noparse][[/noparse]Actionscript] doesn't currently have the capacity to access any serial ports directly, so you need something to bridge between the VCP and Flash. What I have developed does this via sockets on Windows, but not Mac. I'm sure someone out there has either a Java or Mac implementation.
One workaround may be to connect to the socket remotely. Connect the BS to a PC, run a socket server, and connect to the socket using the IP address and port number.
Good luck!
Sharon.
If you are using Flash V8 you will need to adjust the security settings to allow the swf included to communicate with the localhost.· Or, you can just run the fla in the flash IDE.· [noparse][[/noparse]Or, you can communicate with the socket server from a remote location via IP + socket address]
Instructions:
For use with at least a BS2 and a PC with .NET 2.0 [noparse][[/noparse]you can open the *.swf file in Internet Explorer if you do not have Flash installed].
1.· Program BS2 with serialIO_simple.bs2
2.· Launch Socket2SerialServer.exe...if you get a warning it is because we are opening a socket, not doing anything nasty.
3.· Press the help button and follow the directions [noparse][[/noparse]the default settings should be fine].
4.· Launch CONNECT.swf
5.· Press the connect button.
6.· Press reset on the BS2 and you should see a stream of [noparse][[/noparse]ascii] numbers appear in the Rx box.
7.· Use this framework for further development.· Note the function handleIncoming(messageObj) in CONNECT.fla. This is where you'll do most of the work.
8.· Sorry, but the socket2serial.server application will only work until May 15, 2007.· And if you close the socket connection you will likely need to restart the application.· Ocassionally the thread doesn't die, I'm working on that bit.· Kill it in task manager.
Just wanted to let you know that I have solved the stamp/Flash communication problem (using a MAC). If anyone needs the help please feel free to email me (syounger@fmnh.org)
I will post all the info up here in the near future.
Thanks for everything.
Sharon.