Introduction: Arduino Robot Control Console Program With the Visual Basic

About: Mechanical engineer, Entrepreneur, Maker, robotic systems expert and founder of Robimek and RobiBot

We will do our robot console to manage this project with Visual Basic.

We will manage our robot via Bluetooth.

Tools Required to our form:

  • 13 Number Button
  • 2 Number combobox
  • 1 Piece texbox
  • 1 Piece GroupBox
  • 1 Piece SerialPort

http://make.robimek.com/arduino-making-robot-control-console-program/

Step 1: Part of Our Form Design:

You can design in this way.

Step 2: System Library:

  • First, we add to the system library.

Imports System.IO

Imports System

Imports System.ComponentModel

Imports System.ThreadingI

mports System.IO.Ports

Step 3: Form Load

Form part of the loader are adding value to serial port and baud rate.

myPort =IO.Ports.SerialPort.GetPortNames()

ComboBox2.Items.Add(9600)

ComboBox2.Items.Add(19200)

ComboBox2.Items.Add(38400)

ComboBox2.Items.Add(57600)

ComboBox2.Items.Add(115200)

For i = 0 To UBound(myPort)

ComboBox1.Items.Add(myPort(i))

Next

ComboBox1.Text = ComboBox1.Items.Item(0)

ComboBox2.Text = ComboBox2.Items.Item(0)

Button12.Enabled = False

Step 4: Serial Port

We define the serial port object.

Dim myPort As Array

Delegate Sub SetTextCallback(ByVal [text]As String)

Shared _continue As Boolean

Shared _serialPort As SerialPort

Step 5: Connect Button

Let's connect button to define the task of the port.

SerialPort1.PortName = ComboBox1.Text

SerialPort1.BaudRate = ComboBox2.Text

SerialPort1.Parity = IO.Ports.Parity.None

SerialPort1.StopBits = IO.Ports.StopBits.One

SerialPort1.DataBits = 8

SerialPort1.Open()

Button13.Enabled = False

Button12.Enabled = True

Step 6: Disconnect Buton

Let us define the disconnect button to terminate the connection with the robot.

SerialPort1.Close()

Button13.Enabled = True

Button12.Enabled = False

Step 7: Serial Port ComboBox

Let us define the ComboBox to see one of the open ports.

If SerialPort1.IsOpen = False Then

SerialPort1.PortName = ComboBox1.Text

Else

MsgBox(“It will not be changed while port open!”, vbCritical)

End If

Step 8: Baudrate ComboBox

Let us define the ComboBox other to set the Baud Rate for our values.

If SerialPort1.IsOpen = False Then

SerialPort1.BaudRate = ComboBox2.Text

Else

MsgBox(“It will not be changed while port open!”, vbCritical)

End If

Step 9: Directional Buttons

We are doing our definition of the direction buttons.

A value different from each serial port will send button we press the button. For example we press the forward button one value, you send two values we press the back button. Let us for example to define a button.

SerialPort1.Write(“2″)

Here, we print the value 2 serial ports.
Other buttons will need to değerinideğiştirerek data only for identification.

Step 10: Keyboard Key Assignments From

Finally, it will be enough to change if you want to manage from your robot keyboard key priorities that part KeyDown the features section of the form true structure and the following description of the KeyDown of the form add these definitions is just a button içindir.dig button while the identification of button name and keyboard keys.

If (e.KeyCode = Keys.A) Then

Button1.PerformClick()

Button1.BackColor = Color.Red

TextBox1.Text = “Go Left”

Else

Button1.BackColor = Color.Yellow

End If

It also shows the status of the robot when the button is pressed, and we have done here in the definition to change the color of the button.

Step 11: More İnformation