Italy
Asked — Edited

Where To Declare Ezb

Hello.

I am trying to use visual basic for controlling ez-board, but i have some difficult about beginning using it. I have read your tutorial and every post in this forum, but i still have not understand where i have to declare ezb.

Imports EZ_B Imports EZ_B.CameraDetection Imports System

......where do i have to write these lines? In 'sub form load'? In every buttons?

At the moment, i want a project with only a form and a button. Pressing the button, a servo must move to 50%. Can someone please suggest how to do this?

Thank you very much.

Ema from Italy


ARC Pro

Upgrade to ARC Pro

Join the ARC Pro community and gain access to a wealth of resources and support, ensuring your robot's success.

#1  

you need to add the ez_b.dll as a reference to your project, then you can declare ez_b , and you will have a small toolbar etc..

User-inserted image

watch the beginning of the video, dj will show how to do this with the VB SDK. he will then show you basic usage...

so enter your code in any user/click event.like this one will load with the form, but will control trackbar1


Private class form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
trackbar1.mindistance = EZ_B.Servo.SERVo_Min
trackbar1.maxdistance = EZ_B.Servo.SERVo_Max
trackbar1.value= EZ_B.Servo.SERVo_Center
End Sub
end class

how much experience do you have with vb?.... it's muck easier to use EZ_Builder controls all you have to do is change the ports to your config. or if you want to use EZ_Scripting


# moves servo d1 to position 10 etc...
servo(d1,10)

Italy
#2  

I have whatched videotutorial, but i don't understand english very well, so i have understood less.....

I have added ezb_dllas reference as tutorial said.

But now, i don't know what to do.

My project is loading. Sub form load: EZ_B.Servo.SERVo_Min is an error because it was not declared..........

#3  

Lei deve aggiungere l'ez_b. il dll come un riferimento al suo progetto, poi lei può dichiarare ez_b e lei avrà una piccola barra degli strumenti ecc.

User-inserted image

Guardare l'inizio del video, dj mostrerà come fare questo con il VB SDK. La mostrerà poi l'uso fondamentale...

così entrare il suo codice in qualunque operatore/scatto per che avvenimento.amando questo caricherà con la forma, ma controllarà trackbar1

 
la classe Privato form1 Privato Sotto Form1_Load(ByVal il mittente Come il Sistema.Oggetto, ByVal e Come Sistema.EventArgs) Maneggia il
MyBase.Carico 
trackbar1.mindistance = EZ_B.Servo.SERVo_Min 
trackbar1.maxdistance = Sotto di Fine di EZ_B.Servo.SERVo_Center di 
trackbar1.value= di EZ_B.Servo.SERVo_Max la classe di fine
 

Quanta esperienza lei ha con il vb? .... è il letame più facile usare EZ_Builder i controlli tutto lei deve fare è il cambiamento i porti al suo config. o se lei vuole usare EZ_Scripting?

 # Muove il servomeccanismo d1 per posizionare 10 ecc.. 
servo(d1,10) 

#4  

Public Class Form1


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        TrackBar1.Minimum = EZ_B.Servo.SERVO_MIN
        TrackBar1.Maximum = EZ_B.Servo.SERVO_MAX
        TrackBar1.Value = EZ_B.Servo.SERVO_CENTER
    End Sub


    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll

        EzB_Connect1.EZB.Servo.SetServoPosition(EZ_B.Servo.ServoPortEnum.D14, TrackBar1.Value)
    End Sub

    Private Sub btnGetADC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetADC.Click

        lblADCVal.Text = String.Format("{0} Volts", EzB_Connect1.EZB.ADC.GetADCVoltage(EZ_B.ADC.ADCPortEnum.ADC0))
    End Sub
End Class


Belgium
#5  

Hi Odt,

Welcome to the inspiring community of EZ-B !

I assume you already have the 'EzB_Connect1' control on your form. If not, follow the tuturial and do so first. Suppose you have a button on your form and that button is named 'btnLeftTurn'. You can past this line of code in the 'click' event of that button. So draw a button on the screen, double click it and you'll end up in this click event. At the end of the line you'll see 'D7,0'. This means your servo has to been connected with port D7 on your EZ-B board. The '0' means the minimum value of the servo.

Private Sub btnLeftTurn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLeftTurn.Click EzB_Connect1.EZB.Servo.SetServoPosition(EZ_B.Servo.ServoPortEnum.D7, 0) End Sub

If you want to toggle between minimum and maximum values, you could place a second button, let's call this one 'btnRightTurn'. Here you can past this line of code:

Private Sub btnRightTurn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRightTurn.Click EzB_Connect1.EZB.Servo.SetServoPosition(EZ_B.Servo.ServoPortEnum.D7, 100) End Sub

Now you'll notice the 'D7,100' instead of '0', so the servo will move to the 'other side'.

Good luck and enjoy it.

Italy
#6  

Thanks to all. I have understand and now i am able to move servos, but i have another strange problem about camera detection.

Following the examples in sdk-folder (tutorial 3), i have an error: "FileNotFoundException Impossible to load file or assembly FFMPEG.dll or one of dependence".

Well, i have added in 'project - add reference' the FFMPEG.dll and every other .dll files, but the error is still here.... Do someone know why?

Thank you.

Ema from Italy

Italy
#7  

I have spent many time trying to understand this error, but no lucky.

Does someone has connected a camera using VisualBasic? Can i have some explanation about?.....

Thank you and scuse me for my newbie and for my bad english.

Ema from Italy.

PRO
Synthiam
#8  

have you loaded the example in the EZ-SDK ZIP file? There is a camera example for Visual Basic

Italy
#9  

Yes, i have tried the example, but i have the error

System.Io.FileNotFoundEXCEPTION FileNotFoundException. Impossible to load file or assembly FFMPEG.dll or one of dependence.

Exception first-chance type 'System.IO.FileNotFoundException' in System.Windows.Forms.dll

The problem seems to occour in the line: _camera = New Camera(EzB_Connect1.EZB)

Do someone know a solution?

Italy
#10  

Help please.

#11  

@odt- Have you tried re-installing the SDK?

I don't have my kit yet so if that does not help, give me a couple of weeks and if no one helps you I'll install the SDK and see if I can figure it out. I'm just not experienced with EZB yet so I can't really help yet. I am however quite crafty and am pretty good at solving problems. I've been asking lots of questions because I don't have the hardware yet to just try stuff and figure it out. (Once again, I thank the EZ community for all of their input and information.)

From a programmers stand point it seems to be aninstallation or configuration issue. The error you posted says "I can not find something." So a file is missing OR it is looking in the wrong place for the file. I know you do not speak English well so if no one helps you out by the time I try to figure it out, I'll try to get 'someone' to translate. Hoping that 'someone' is still watching the thread and is willing to translate again ;-)

I wish I could be more help, just know that I won't let you fall between the cracks. Even if it takes some time. I should have my hardware on 4/29 so give me a little time to play with it and I'll see what I can do. I did plan on installing the SDK and using C# in the near future anyway. I have some experience with C# so my plan was, "If EZ-Script confuses me I'll do it all in C#." I'll keep an eye on this thread. I hope someone can help you out before I can.

Italy
#12  

I have try to install Sdk on two Pc and the same error occours in both computer, so, i think the error is mine. Surely i am doing something wrong in configuration, but i am not able to find the problem.....

Italy
#13  

.....i have spent another day trying to solve the problem and i am a little tired...... I am beginning to think to cut-off ez-board and use Arduino. It is easyest to control from VisualBasic.

Netherlands
#14  

Hi,

I had the same problem. You need to add the directory with the ffmpeg.dll file to your system path.

Windows 2000, XP, Vista, Windows 7


  1. Right-click on the My Computer icon. (Under Windows XP, Vista, or Windows 7, the My Computer Icon may be located in the start menu.)

  2. Choose Properties from the context menu.

(Alternatively, you can double-click on the System icon in the Control Panel)

  1. Click the Advanced tab or "Advanced system settings" on Windows Vista or Windows 7

  2. Click the Environment Variables button.

  3. Click on the variable called 'Path' and then click on Edit. Now add the target directory to the value of the variable, using a semi-colon as a separator.

This is what it looks like for me:

C:\Program Files\AMD APP\bin\x86;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\MATLAB\R2012a\runtime\win32;C:\Program Files\MATLAB\R2012a\bin;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;c:\ffmepg\bin;C:\Users\Boon\Documents\Minion\EZ-SDK\DLL

note the last line: ....\EZ-SDK\DLL

You will probably have to restart your PC before your IDE will recognize the path.

Hope this helps you, Boon.

PRO
Synthiam
#15  

That is one way to do it - the other is to copy the files from the EZ-SDK DLL folder into your application folder.

For example, the files necessary for all EZ-SDK functions to work are found in the EZ-SDK DLL folder. Those files must be in you executable folder. You can either manually copy them, or add the files to your project and modify their property to be copied.:)

When working with libraries in your custom application, they will always need to be copied into the executable folder. The library DLL files that are dependencies will need to be accessible by the application. This can be done by either being in the path, or by being included in the executable folder.

The files that must be included are...

Quote:

aForge.dll avcodec-53.dll avdevice-53.dll avfilter-2.dll avformat-53.dll avutil-51.dll EZ-QRCode.dll EZ_B.dll FFMPEG.dll iweardrv.dll iwrstdrv.dll swscale-2.dll

Italy
#16  

Ooooh! I would never been able to do it without your help!

Thank you Boon! Now the program starts without errors! You have been very very helpful for me!

#17  

@DJ Where have I read that before? Oh, yeah, the readme.txt file for the SDK.....

Maybe you need to add a sentence to the SDK download web page telling people to read the readme file for instructions on SDK use. You seem to have to answer this question at least once every two weeks.

Alan

Netherlands
#18  

@Odt Glad i could help!:)

@thetechguru and @DJ The readme file didnt tell us this. This is the readme file wich we read, and followed step by step:


Welcome to EZ-B!

Documentation

  1. If you load an example tutorial solution into Visual Studio, you may get an error about not being able to find the EZ_B.DLL file. You will need to manually add the DLL file as a reference to each project.

    Right Click on Project -> Add Reference -> Browse -> Select EZ_B.DLL from DLL folder

  2. The default passkey to connect to the EZ-B over bluetooth is "1234".

  3. Be sure to download ARC from www.ez-robot.com and obtain the latest Firmware update

  4. Projects must be compiled as x86 (not 64 bit). Configure your project to generate x86 (32 bit) binaries. Right click on project, select Build and change the CPU to x86

  5. Projects must be configured for .Net 4 runtime


I suggest you add point 1.5:

1.5) If you still get the error, also make sure to put the .dll files in your project directory itself.

PRO
Synthiam
#19  

I added the bit earlier today to the readme.txt

It's normal development practice:) now you know

Libraries need to be accessible from the executable.

Italy
#20  

Dear Thetechguru, adding the files in the application folder, the error continues to be and nothing has solved. I tryed this before post my question.

And i have read the readme.txt file and i have read ALL THE FORUM, but the right way was another and it was very difficult for me.

Boon has show the way to do this, and this was not shown in any post in this forum and in any tutorial in this website. Thanks to Boon again!

#21  

Good to hear Boon fixed it for you. It did work for me. Both VB and C# (although I haven't done anything other than run the examples with it yet).

--- edited ---

I just realized that I already had the ffmpeg.dll in a directory in my path from another app, and I did put all of hte EZ dll's in my app directory because I have lived with enough DLL hell that I always do that.

Alan

#23  

Not sure if this would be the correct placement of this thread, but seen the question asked before in here.I am testing the related vb.net program of ez-board these days. I don't know where to declare Ezb because I am totally a green hand on vb.net. Any suggestion will be appreciated. Thanks in advance.

United Kingdom
#24  

Post #2 has your answer