Make an EZ-Builder Behavior Control

5. Add Buttons

Now that the MainForm has been created, it will be the form that users see when using your plugin. The form is currently empty without any buttons, making it a boring plugin. In this step we will add two buttons to move servos between different positions.

1) Press the DESIGN tab to view the graphic designer for your MainForm
User-inserted image


2) Locate the Button under All Windows Forms in the Toolbox. Drag two buttons anywhere onto your MainForm.
User-inserted image


3) Give the buttons readable text that tells the user what they will do. In this tutorial example, we will be programming the buttons to move a servo between two positions. Click on each button and locate the Text field in the properties window.
User-inserted image


4) Double click on each button in the Designer and code will automatically be generated for the Click event of each button. This means that when a user clicks on the button, the code within the function will be executed. The functions are automatically inserted into your code when you double click on them from the designer.
User-inserted image


5) Insert code into each of the button click events to move a servo. The command to move a servo is located within an EZB class. Because EZ-Builder allows more than one EZB connection, the list of EZB's available is an array. It is safe to assume that the first EZB is used the most. Here is the code which will move the servo connected on the EZ-B port D0 between position 10 degrees and 170 degrees when the buttons are pressed.

Code:


private void button1_Click(object sender, EventArgs e) {
EZ_Builder.EZBManager.EZBs[0].Servo.SetServoPosition(EZ_B.Servo.ServoPortEnum.D0, 10);
}

private void button2_Click(object sender, EventArgs e) {
EZ_Builder.EZBManager.EZBs[0].Servo.SetServoPosition(EZ_B.Servo.ServoPortEnum.D0, 170);
}


6) When your code has been entered, it will now look like this.
User-inserted image


7) Let's compile your project to ensure there are no errors before continuing to the next step. Press CTRL-SHIFT-B and watch the Output window for any error messages. If everything compiles okay, you will see a similar message result to the screenshot below.
User-inserted image



Assuming you have no errors and everything compiles fine, we can move on to the next step. In the next step we will cover how to create an entry in the plugin section of the ez-robot website to auto-generate an XML file so you can test your plugin!

#7  
I am trying to follow the instructions for adding my own plugin but I cannot seem to find the place to register the plugin based on the instructions.

Any help is appreciated.

Thanks
Synthiam
#8   — Edited
The new button to create a plugin behavior control is less than an inch below the button you pressed to create this question. :)

User-inserted image
#9  
Thanks for the quick response.

This what happens when you are working on robotics when its way past your bed time.

You miss the obvious
#11  
User-inserted image


User-inserted image


User-inserted image


User-inserted image
Sorry but can I ask you something why I didn't see the EZ-Builder library when I added visual studio even though I set up the C ++. DLL library and there's another way to execute it and send / receive console in out but I don't know how to do it with EZ_builder?
Synthiam
#12   — Edited
Please follow the tutorial. It’s impossible to know why you’re plug-in isn’t showing up without asking you if you followed each step of the tutorial:)