Back to Blog
![]() Make sure you drag the Serial Port control icon from the Toolbox onto your form. You can add error processing and more intelligence based on your particular needs. ![]() The purpose of this code is to simplify explanation of how to connect VB to Arduino. I used COM10 as a serial port but you can (and must) change it to match your Arduino serial port. On the Arduino Uno, PIN 13 is attached to a an on-board LED. If you have an LED on PIN 13, you can turn it on and off. If it see 1 it will turn PIN 13 on and if it sees 0 it will turn PIN 13 off. The Arduino Uno Sketch code simply waits and reads the serial port. ![]() See attached photo of my simple form design. Button1 sends a 1 and Button2 sends a 0 to the serial port COM10 (change this to match your PC to Arduino port setting) The Visual Basic 2010 code assumes you have Form1 with 2 buttons Button1 and Button2 and SerialPort1 controls. This is a skeletal Visual Basic 2010 and Arduino Sketch that I mixed together to test the PC to Arduino Uno connection via serial. I know this has been done in the past a few times so here's one more.
0 Comments
Read More
Leave a Reply. |