-->![Visual Visual](https://i1.wp.com/inkubator-teknologi.com/wp-content/uploads/2014/03/Skematik-kontrol-4-LED-VB.jpg)
![Serial Serial](https://i.ytimg.com/vi/p2TZ-x_Brjo/maxresdefault.jpg)
Komunikasi serial pada PC masih sering digunakan untuk beberapa aplikasi yang membutuhkan koneksi dengan mikrokontroler. Mikrokontroler yang mempunyai USART dapat terkoneksi dengan port serial pada PC dengan konektor DB9 dengan menggunakan RS232 standard. Nov 19, 2010 ASK komunikasi serial dari mikrokontroler ke vb; Login. Selamat datang, Pengunjung. Silahkan masuk atau mendaftar. Apakah anda lupa aktivasi email? Visual Basic » ASK komunikasi serial dari mikrokontroler ke vb. Topik Terkait Subyek / Dimulai oleh Jawaban Tulisan terakhir.
![Visual Visual](https://i1.wp.com/inkubator-teknologi.com/wp-content/uploads/2014/03/Skematik-kontrol-4-LED-VB.jpg)
This topic describes how to use
My.Computer.Ports
to send strings to the computer's serial ports in Visual Basic.Example
This example sends a string to the COM1 serial port. You may need to use a different serial port on your computer.
Use the
My.Computer.Ports.OpenSerialPort
method to obtain a reference to the port. For more information, see OpenSerialPort.![Serial Serial](https://i.ytimg.com/vi/p2TZ-x_Brjo/maxresdefault.jpg)
The
Using
block allows the application to close the serial port even if it generates an exception. All code that manipulates the serial port should appear within this block or within a Try...Catch...Finally
block.The WriteLine method sends the data to the serial port.
Compiling the Code
- This example assumes the computer is using
COM1
.
Robust Programming
This example assumes the computer is using
COM1
; for more flexibility, the code should allow the user to select the desired serial port from a list of available ports. For more information, see How to: Show Available Serial Ports.This example uses a
Using
block to make sure that the application closes the port even if it throws an exception. For more information, see Using Statement.