Asked — Edited
Resolved Resolved by Redzone!

Scripting A Connection To A Second Ezbv4

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!


ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

#1  

Servo(1.D2, 180)

0.d1 = EZB board 0 digital port 1 1.D2 = ARC board 1 digital port 2 And so on

#2  

@merne Yeah - My question is not how to address the port on the board (once it is running). That's simple.

Can I CONNECT to Board 1 with CODE?

#3  

Can you give an example. are you asking if you can use ControlCommand to connect to board 1 if you have not manually push the connect button?

Controlcommand("connection", Connect1)

This is listed on the tab " cheat Sheet" when you open a script

Hope this is what you are asking

Cheers

#4  

BRAVO! (partly)

Interesting... Board 1 connected, executed it's Init Script, and when finished, the Init Script for Board 0 did NOT continue executing.

Bad Dog. Is there a way to get the rest of the InitScript for Board 0 to complete?

#Board 0 Script: SayEZB("Initializing Board Zero") Sleep(2000) ControlCommand( "Connection", "Connect1" )

#do the rest of my init routines for Board 0 here (is not happening...)

#5  

You need to increase the sleep command longer, thats what the sounds like. I believe you can also use a wait command to. Can you post a sample script?

PRO
Synthiam
#6  

First, use the [ code ] formatters if you wish to display code

second, use the SayEZBWait() command if you want to wait for it to speak.


#Board 0 Script:
SayEZBWait("Initializing Board Zero")

ControlCommand( "Connection", "Connect1" )

# do some other stuff

The EZ-Script manual is along the right when editing scripts. Here's a screenshot

User-inserted image

When you see something BLUE in someones reply, you can click on it. For example the Cheat Sheet is in blue. Click on it so you can read about it. Also, ControlCommand is in blue, click on it so you can read about it.

#7  

Here is the InitScript running on Board 1 (ps Thank you for your help with this!)


SayEZB("Initializing Board One")
UARTInit( 1, 2, 9600 ) 
Sleep( 3000 ) 
SayEZB("Initializing Head and Neck Servos")
#Head Vert
Servo( 1.D0,125 )
ServoSpeed( 1.D0,1 ) 
SetServoMin( 1.D0,30 ) 
SetServoMax( 1.D0,165 )
#Head Rot
Servo( 1.D1,125 )
ServoSpeed( 1.D1,1 ) 
SetServoMin( 1.D1,20 ) 
SetServoMax( 1.D1,180 )
#Head Side
Servo( 1.D2,145 )
ServoSpeed( 1.D2,1 ) 
SetServoMin( 1.D2,30 ) 
SetServoMax( 1.D2,180 )
#Jaw
Servo( 1.D3,105 )
ServoSpeed( 1.D3,1 ) 
SetServoMin( 1.D3,105 ) 
SetServoMax( 1.D3,160 )
#EyesV
Servo( 1.D4,95 )
ServoSpeed( 1.D4,1 ) 
SetServoMin( 1.D4,70 ) 
SetServoMax( 1.D4,125 )
#EyesH
Servo( 1.D5,105 )
ServoSpeed( 1.D5,1 ) 
SetServoMin( 1.D5,60 ) 
SetServoMax( 1.D5,130 )
 
#Head Vertical Movement
SayEZB("Looking Down") 
Servo( 1.D0,30 ) 
Sleep( 2000 ) 
SayEZB("Looking Up") 
Servo( 1.D0,165 )  
Sleep( 2000 )  
SayEZB("Looking Ahead") 
Servo( 1.D0,125 )
Sleep( 2000 ) 

#Head Rotation
SayEZB("Looking Left") 
Servo( 1.D1,20 ) 
Sleep( 2000 ) 
SayEZB("Looking Right") 
Servo( 1.D1,180 )  
Sleep( 2000 )  
SayEZB("Looking Ahead") 
Servo( 1.D1,110 )
Sleep( 2000 ) 

#Head Sidebending
SayEZB("Sidebending Left") 
Servo( 1.D2,180 ) 
Sleep( 2000 ) 
SayEZB("Sidebending Right") 
Servo( 1.D2,30 )  
Sleep( 2000 )  
SayEZB("Looking Ahead") 
Servo( 1.D2,130 )
Sleep( 2000 ) 

#Jaw Open Close
SayEZB("Opening Mouth") 
Servo( 1.D3,160 ) 
Sleep( 2000 ) 
SayEZB("Ahhhh")
Sleep( 2000 ) 
SayEZB("Closing Mouth") 
Servo( 1.D3,105 )  
Sleep( 2000 )  

#Eyes Look Up and Down
SayEZB("Eyes Looking Up") 
Servo( 1.D4,125 ) 
Sleep( 2000 ) 
SayEZB("Eyes Looking Down") 
Servo( 1.D4,70 )  
Sleep( 2000 )  
SayEZB("Eyes Looking Ahead") 
Servo( 1.D4,95 )  
Sleep( 2000 )  

#Eyes Look Left and Right
SayEZB("Eyes Looking Left") 
Servo( 1.D5,130 ) 
Sleep( 2000 ) 
SayEZB("Eyes Looking Right") 
Servo( 1.D5,60 )  
Sleep( 2000 )  
SayEZB("Eyes Looking Ahead") 
Servo( 1.D5,105 )  
Sleep( 2000 )  

SayEZB("Completed Initialization, Testing Neo Pixel")
SendSerial( 1.D18, 9600, "W250,0,0,250,0,0")
Sleep( 2000 )
SendSerial( 1.D18, 9600, "C0,0,0")
Sleep( 2000 ) 
SendSerial( 1.D18, 9600, "S250,0,0,250,0,0")

#END of Board 1 Script - should pass control back to Board 0 calling script...

PRO
Synthiam
#8  

I edited your post and put [ code ] [/ code ] tags around the code so people can read it