Nov. 15........Serial 2
Assignment Journal 08
Boy playing on the roof
I felt very excited about getting BX-24 and Director to work together. I wanted to use sensors as my input device but I have very limited knowledge about sensors. I realized that all I could use was the Pot and the switch. Well, then it is. What can I do with Pot and the switch? Hmmm, with the Pot I can make something move back and forth; and with switch, I can activate some action. Well, so there it goes! A little game, let's just call it Boy Playing on the Roof or something like that.
Basically you use the left and right keys on the keyboard to make the boy move left and right. Then you use the Pot to get the swing to a particular point and press the switch to make the Boy jump. If you don't press jump and just make him go all the way left, he falls. And also, if you make him jump before the swing is in the right place, the swing won't be able to catch him and he falls too.
make sure the BX-24 and your computer talk to each other.
Write "call and response" code on BX-24 and Director.
You make BX-24 wait for signals that Director sends out, check if that's the one you set up and then send out according values.
Also, you make Director send out the value and then read in whatever is sent out by BX-24 and put those values(in my case, there are two) into the Variables.(**Refer to Obstacles because there's something wrong with this part and I had to change the code later)
Go to Director and make sure it gets what BX-24 sends out. Here I use the two little boxes on the left side to monitor the value Director gets.(** I cheated a little bit and I have to change my code after I know Direcotr gets the message. Resons see Obstacles)
Fix your Serial code accordingly to ensure what you do on BX-24 is read and used by Director.(yeah, right, where do I put the code? movie script or exitframe?? I spent a lot of time putting the codes around Director...)
Special notes:
At first I set up BX-24 to send out two false numbers until it gets signals from Director. But later I found that BX-24 is sending output faster than Director. BX-24 kept going between the "I don't get signal" and "I got a signal" conditions. And what Director got become changing between the correct values and the false ones. Therefore I had to fix BX-24 to send out the correct values all the time so Director can get the right values and work on them.
I have keydown script and serial script. It seems that I have to put every code concerning serial input to the "checkSerial" script to make it work. If I just put it on existframe, it seemed to be trapped in the "checkSerial" handle and won't go further to process the other codes.
I encoutered several problems. The first was I forgot to close the Hypterterminal window so Director kept prompting "Object not found" message window. Remember to close other programs that share the same COM port with Director.
At first the Director got true values and false values at the same time. It turned out to be BX-24 was sending out signals faster than Director fed it with a "response"
It seems I have to put every script concerning SerialInput into the CheckSerial handle otherwise Direcot doesn't process them at all. Don't know why.
Pic and code and Schematic....see the chartsee the code
the two yellow boxes on the left is the monitor for me to see if Director is getting the right values from Bx-24. After I make sure it gets the right values I can focus on how it processes the input values.
Download Director file to play with BX-24
  Download Director file to play within Director