Shop OBEX P1 Docs P2 Docs Learn Events
Director Xtra to BS2 — Parallax Forums

Director Xtra to BS2

396driver396driver Posts: 4
edited 2004-10-15 21:56 in BASIC Stamp
I'm having much trouble with communicating from Director (using SerialXtra). I've create a simple LED on the basic stamp to light up when the code recieves a letter such as "1". It works within the basic stamp software, but when I send from director nothing happens. I think the problem is the baud or something that keeps the two from communicating, maybe the pin setting. Does anyone have the code for both basic stamp and director to do this simple task. I have found a couple of examples but code is not complete and I have to guess at some of the settings. This should be easy, but I'm having a·bad time of it. Thanks in advance.

darryl

I'm using the basic stamp of education with the provided serial cable db9, I'm using the serial port on a laptop. I'm using Director MX with the SerialXtra plug-in.
Here is the code I'm trying to get working:

Director code:

exitFrame

put "start movie"

openxlib "serialXtra.x32"

serialObj = new( xtra "serialXtra")

if objectP(serialObj) then

serialObj.writeChar("1")

put "open the object"

serialObj.openPort("COM1")

if serialObj.IsPortOpen() then

put
"object is open"

serialObj.setProtocol(9600,"n",8,1)

serialObj.writeChar("1")

end if

end if


serialObj = 0

closeXlib

end

Basic Stamp code (I borrowed from a forum·example):

'{$STAMP BS2}

'{$PBASIC 2.5}

rpin CON 16

bmode CON 16468

maxtime CON 10000

test VAR Byte(3)

Main:

SERIN rpin,bmode,maxtime,timeout,[noparse][[/noparse]DEC test]

IF test = 1 THEN turnOn

'PAUSE 3000

GOTO main

timeout[noparse]:D[/noparse]EBUG"Timeout", CR

PAUSE 1000

GOTO main

turnOn:

HIGH 14

GOTO main


·

Comments

Sign In or Register to comment.