Arduino – Control Servo with Visual Basic

Hi guys,site

Today I’ll show how you can control a servo with Visual basic. Before this project I’ve never used Visual basic so if anyone finds any mistake in my code please leave a comment here and help me improve it.

I’ve always used the Serial Monitor of the Arduino IDE to communicate with the Arduino, but today we will use a visual basic program that I’ve created. Basically in the VB program we have 4 buttons that will interact with the Arduino when we press them.

I’ll be showing program in Visual Basic that allows the user to rotate a servo attached to the Arduino. You need to make 3 connections from the servo to your arduino:

  • Red: 3.3V (depends on your Servo motor)
  • Brown: Ground
  • Orange: Digital Pin 9

NOTE:

  • When you’re using the Visual Basic Program the Serial monitor on the Arduino IDE must be closed
  • You need to match the com port on your Visual Basic Code to the right com port you’re Arduino is using

I don’t know why but youtube cropped my video, the Last two buttons are “Rotate 180º Left” and “Rotate 180º right” .

Thanks for reading, leave a comment or send me an email. If you like this post probably you might like my next ones, so please support me by subscribing my blog and my Facebook page (you can find everything right column )

Advertisements

About Rui Santos

Arduino Tinkerer. Circuits Designer. Electronics Hobbyist. Blogger and Entrepeneur. I live in Portugal and I'm studying electrical engineering.
This entry was posted in Arduino, Arduino Tutorials and tagged , , , , , , , , . Bookmark the permalink.

8 Responses to Arduino – Control Servo with Visual Basic

  1. frank says:

    hello possible program basic for two servos ? pan-tilt command ? regards frank

  2. Rui Santos says:

    yes it’s possible to do that! you can attach 2 servos or more.
    I based my arduino code in the example from the arduino IDE called ‘sweep’.
    but for a pan tilt comand you to change the code a bit, you will need to move the servo from degree to degree when the key is pressed on VB, instead of rotating 90 or 180 degrees at once.
    if you know something about VB you just need to addapt the buttons to do whant you want. (turn: right, left, up and down) basically you just need to change the text name from my buttons.
    the most work you need to do it’s on the arduino code

  3. al says:

    how to controll wifi arduino on visual basic code?

    • Rui Santos says:

      Hi, actually I never tried that, i know it’s possible but I would need to search bit to be able to do that… Sorry

      • al says:

        thanks for reply, actually i’m a technician, i know the connection but not on programming so can you research for me using visual basic to ethertnet shield connection?

      • Rui Santos says:

        I’m sorry actually I don’t have time to do that, I have 3 projects running right now and one contest, otherwise i would do some research about that…

  4. Leandro Olviera says:

    que versao de arduino usou ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s