

The VB code for this form is the following one: ' VB program to communicate with Arduino via USB interface The “Clear” buttons delete their respective Rich Text Boxes. The right Rich Text Box than keeps trace of the sent data. On the right, one can write chars to send to Arduino by pressing “Send”. We can set a timer (Interval property) to 1 s, so that it is synchronized with the arrival of messages from Arduino. They are then written, together with date and time, in the Rich Text Box on the left. The “Connect” button establishes communication with the chosen port and starts a timer which, at regular intervals, reads messages from Arduino. One can choose the desired COM port to establish communication in the dedicated combo box the application loads a list which includes only the COM ports available in Windows. However, it could be adapted for different versions by means of proper modifications. My code is written in the VB version from Visual Studio 2012 and, as a consequence, it differs from previous versions.
#Arduino communicate with computer serial
Once proved, by means of the Serial Monitor, that the board actually sends the desired string, we can move to the PC side. The Arduino code is really brief: byte LEDpin = 13

It sends the “1234” string every second via USB, and it turns on the built-in led on pin 13. I exploited an Arduino Micro detected by Windows on the COM9 port. This window shows strings sent by Arduino, and also allows for communication in the other direction: Whoever knows Arduino is – for sure – familiar with the Serial Monitor window. Much of what you read here is based on two good articles by Martyn Currey, available here: This is a two-way communication or, in other terms, one in which both devices send and receive messages. We can now establish a USB interface between a computer and Arduino. This is the first part of a brief tutorial about my procedure to start making an application to act on Arduino by means of the Xbox 360 controller. This article describes the Arduino-PC communication via Visual Basic.
