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

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

#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