Asked
— Edited

Upon manually connecting to Board 0, I would like to establish a connection to Board 1 using EZ-Script, process some initialization there (ie: 1.D0 do thus and such) Can I and if yes, how do I connect to Board 1 from script?
Thanks!
I understand the logic, and tested it's implementation, but it also failed. This leads me to believe that control is never passed back to the InitScript for Board 0. Perhaps I need to call a regular script from the Board 0 Init Script and have that script connect Board 1, wait for the change... Any ideas why control won't pass back to the first script? If vars are GLOBAL then perhaps I can do a ControlCommand("Connection","Connect0") at the end of the script for Board 1, and use if($script!=0) { ControlCommand("Connection","Connect1") }
I worked it out: At the beginning of Init Script for Board 0 I have
and at the end of the Init Script for Board 1 I have
whereupon the Board 0 Init Script executes and skips the initialization of board 1 which has already been done.
Sorry about the slight wild goose chase. Didn't realize that setting to 0 would not work. I usually do this kind of thing using text variables ("yes/no" "right/left"). Big thought it would be easier to explain using integers, but didn't actually test before posting (again, since I have had success with similar scripting).
Glad you got it working.
Alan
I'm currently running 4 EZB's in my robot with lots of scripts running and devices attached to all 4 EZB's. I found that you should be starting all your EZB's and oher devices along with setting all your perimeters in only one INT script. Start all your EZB's first near the top of your "only" INT script. Start and set things like all EZB's, servo min, max, speeds and poisons in this one INT script. Also set most all global variables in this one int script. EZ Script "steps" through your commands one line at a time. Once everything is setup and ready to run in this script only then should you start calling other scripts from this INT script (Multi-Threading) to move or run devices and motors. Watch what is running at any given time. If you try to call the same device or motor to run at the same time or before it's done with what is is doing, something you expect to happen will not work or even lock up or disconnect the EZB.
Also make sure to place Sleep() commands where needed to give devices time to move into place or finish their function. The script will fly by time sensitive commands without letting them complete. If something is not working look at this as a possible issue.
One more tip; If you try to send an improper command through any of the UART ports the EZB will disconnect. You'll also lock up an EZB if you try to send a command through these UART ports before you initialize the one you want to use. If used, Uarts should also be initialized in your "only" INT script. You only need to do this once per EZB boot up.
I'm no shining example of an EZ script code writer but below is my INT script that will explain what I'm talking about:
One last tip. In the future try not to be so quick to mark a help thread resolved until your sure your problem is actually fixed. You run the rick of not getting the help you really need. There are lots of people here willing to lend a hand.
Thanks Dave, these are great tips for mayaway and others. I too was wondering if mayaway had more than one init script. And you're right about not marking solution solved until it's fully solved.
Cheers
Hey thanks guys! These are very helpful tips. I'll consolidate to one Init. I think @DJ said with SendSerial() you don't need the UARTinit. It's probably two dif. ways of doing the same thing. I think I also saw that the ServoSpeed() command needs to be preceded by a Servo() position command. Maybe it used to be... maybe it still is!
No problem Merne. I also had to work through these same issues when I started using more the one EZB. One of the hardest things for me to wrap my mind around was the concepts of multi-threading scripts and how they interact with each other. I still find this challenging at times when complex things are going on. I hope I helped in some way.
After reading through the OP's posts in this thread it sure sounds like he was trying to use separate scripts to start up and set up each EZB. Then run start up routines for devices attached to it's EZB that it's starting.
@mayaway, That's not correct. You always need to start a UART port (Need to do this only once) before you use it. Use the UARTinit() command for the port your going to use in your INT script. If you send a command through the UART port without starting it first you will lock up your EZB.
EDIT: Actually if your sending a Sendserial command through a digital port then your are correct. You dont need to use a UARTinit() command. Only use the UARTinit() command if you're sending through a UART port.
Servo Speed commands are hard to understand (for me at least). Here's a few notes from the Script help section in ARC: