Asked — Edited

Vb Scripting

I'm trying to learn how to use the Visual Basic script control in EZ- Builder and I'm having trouble with the SDK commands. For example, consider the following command form: EZ_B.Servo.SetServoPosition(EZ_B.Servo.ServoPortEnum, System.Int32) If I write just this single line of code after the four "imports" I get this error message: "Declaration expected" Why? I'm also not sure what to enter in the ( ). If I want to position the D4 servo to 60 do I enter (D4, 60) or ( EZ_B.Servo.ServoPortEnum.D4, System.60) or what? Any help will be appreciated.


ARC Pro

Upgrade to ARC Pro

ARC Pro will give you immediate updates and new features needed to unleash your robot's potential!

PRO
Synthiam
#1  

Awesome to see you tackling the VB scripting control:) I would recommend starting with EZ-Script. EZ-Script is incredibly powerful, and even more powerful than the VB Scripting control because it integrates with the ARC environment. VB and the C# scripting controls are beneficial for advanced programmers who wish to create their own controls using Windows.Forms, and therefore require quite a bit of previous experience.

To answer your question, you were very close with the code guess:)

The command would be


imports System
imports System.IO
imports System.Windows.Forms
imports EZ_B

Namespace VName 

  public class VClass   

    Public Sub Main(ezb0 As EZB, ezb1 As EZB, ezb2 As EZB, ezb3 As EZB, ezb4 As EZB)

      ezb0.Servo.SetServoPosition(servo.servoportenum.d4, 60)

    End Sub

  End Class

End Namespace

However, in EZ-Script, it is even easier because it's like this...


Servo(d4, 60)

#2  

D.J., that is a Great Example of how EZ-Script saves time and headaches. If you made a short video of that, you could use it as a Sales Tool.

#3  

Thanks D.J. that helps a lot! By the way I have been using Servo(D_Number, Position) quite a bit in the short time that I've had my kit.

I understand the simplicity and power of ARC/Script and perhaps I'm trying to use VB to solve a problem that I don't yet see how to solve in ARC. I have used Builder enough already to see its value. However, I'm an old (age 75) user of Basic (especially QuickBasic which is really a powerful programming environment when you don't need much user display/interaction). As an engineer I used it extensively, including some pretty sophisticated applications (e.g., control of a gimballed missile seeker and a simulated target on a translator to effect a simulated missile flight to target, including aerodynamics and kinematics). So my love of and capability with Basic makes me want to learn VB since you have provided a neat interface in Builder.

Let me take this opportunity to join the ranks saluting you on the magnificent EZ-Robot system you have created. I can't even begin to imagine the hours of effort you have put in to this. It's obviously a labor of love.

#4  

New problem!

The top of the VB Script window is disappearing (like it's shoved under the top bar) and the far right slide bar is gone. Otherwise I was going great. Is there a limit to the lines of code?

Help, anyone?

Edit: When I added another control (camera) the screen fixed itself! Any idea why?

#5  

Yes, I have this problem also. I asked about this a couple days ago and had another forum member validate that it does happen to others. DJ chimed in and said he'd take a look at it. I imagine it's on his pile and I trust he'll get to it when he can. In the mean time go to the Control tab and click on Smart Arrange. That will bring the windows down into the work space. Sadly all the windows will not be where you placed them and it will happen again. Each time I reboot my computer and restart ARC the project creeps up under the menus. I'm sure we'll get this figured out. Till then just do a Auto Arrange or Smart Arrange.

Have Fun, Dave Schulpius

#6  

Thanks. See the edit note I added above before spotting your reply.

#7  

Humm, I tried that and it didn't work for me. The other member said the same thing as you; that he added a control and it set things right. I haven't had that luck.

I'm having this trouble on 2 different computers, Same project.

Dave Schulpius

#8  

Another problem in ARC: I keep getting a message that says Builder is no longer working and it shuts down. I ran the same effective code with EZ Scripting and VB scripting. The problem seems to be occurring only with VB. I Googled and found DJ Shures' response to this problem in this forum. He says it's a Windows .Net runtime issue. It's effectively shutting me down in VB mode. (Very disappointing because I AM finding that Basic code is less cumbersome for my project than EZ script code.) I am up to date on Windows 7 updates. The odd thing is that I didn't have the problem when I first began using VB scripting.

#9  

Now you are way over my head. Good luck finding your answer. I'm sure there's 1 somewhere.

#10  

I use VB.net in ASP.Net all day. I run the IT department for a $40 million dollar distribution company.

All employees use my software to run the company since the beginning. I have been the only programmer since the beginning of the company when started.

There is nothing you really can't do in VB today. I live in Visual Studio all day.

It would be nice to see examples of everything that the C examples have in the SDK kit in VB.

I would love to use this with data from SQL server.

I will share what I come up with anyone who needs use VB.

I really need quick examples of hardware controls.

If this project I am working on goes down it will be really big in the amount of hardware I will need from EZ.

I will be controlling multiple robots from a central location. When parts are required, robots will go to the location the parts are at and bring the parts to a packer for shipment.