Random Nerd Tutorials

Arduino – Control Servo with Visual Basic


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

Upload the Arduino code below

Run the Visual Basic script

Click here to download the Visual Basic Script


  • 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 tast two buttons are “Rotate 180º Left” and “Rotate 180º right” .

Watch the video demonstration

Thanks for reading, you can contact me by leaving a comment. If you like this post probably you might like my next ones, so please support me by subscribing my blog and my Facebook Page.

Recommended Resources

Home Automation using ESP8266 »
Build IoT projects and home automation gadgets with the ESP8266 Wi-Fi module.

Build a Home Automation System »
Learn how to build a automation system using open-source hardware and software from scratch.

Arduino Step-by-Step Projects »
Build 25 cool Arduino projects with our couse even with no prior experience!

Leave a Comment:

Add Your Reply

⏰ Early Black Friday 2017 Special ⏰
Download all our courses up to 35% off