Showing posts with label arduino vb. Show all posts
Showing posts with label arduino vb. Show all posts

Friday, August 7, 2015

Arduino vs Visual Basic Express 2010

mengontrol pin output pd arduino dengan sotfware visual basic.
Pada contoh ini aplikasi di pc utk meng On/Off kan lampu led pd pin 13 (memberi sinyal high/low).
Code pd arduino spt di gambar.

Code utk VB sbg berikut :-------------------
Imports System.IO
Imports System.IO.Ports
Imports System.Threading
Public Class Form1
Shared _continue As Boolean
Shared _serialPort As SerialPort
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SerialPort1.Close()
SerialPort1.PortName = "com4" 'change com port to match your Arduino port
SerialPort1.BaudRate = 9600
SerialPort1.DataBits = 8
SerialPort1.Parity = Parity.None
SerialPort1.StopBits = StopBits.One
SerialPort1.Handshake = Handshake.None
SerialPort1.Encoding = System.Text.Encoding.Default 'very important!
End Sub
Private Sub btnOn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOn.Click
picOn.Visible = True
SerialPort1.Open()
SerialPort1.Write("1")
SerialPort1.Close()
End Sub
Private Sub btnOff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOff.Click
picOn.Visible = False
SerialPort1.Open()
SerialPort1.Write("0")
SerialPort1.Close()
End Sub
End Class
-------------------------

Video Arduino with VB: https://youtu.be/MWIMOs1PuZs

Pengembangan dari artikel ini bisa ditemukan pada palang pintu parkir, pintu gerbang otomatis, loker kasir dll.