Ads

Tampilkan postingan dengan label VB CS. Tampilkan semua postingan
Tampilkan postingan dengan label VB CS. Tampilkan semua postingan

Selasa, 30 Oktober 2018

Tutorial for Making Software VBNET Arduino Part 2

welcome to erwinproject, this time the admin will discuss the Tutorial for Making VBNET Arduino Part 2 Software. Here I will explain starting from compiling forms in visual basic to coding to connecting to Arduino using serial. let's look at the tutorial below.
  1. The first step is to build a GUI (graphical user interface) or arrange the components needed.

  2. make sure to know the address (name) of the component.

  3. Add Component (drag and drop) "SerialPort" in toolbox . Now press F7 to write program or code.
    ' CODE BY ERWINPROJECT
    ' thanks theme :
    ' - Valley Theme by Earn
    ' - Mono Theme by Vengfull
    ' - Aether Theme made by AeroRev9
    
    Imports System.IO
    Imports System.IO.Ports
    Imports System.Threading
    Imports System.Diagnostics
    
    Public Class Form1
        Dim receivedData As String = ""
    
        Function ReceiveSerialData() As String
            Dim Incoming As String
            Try
                Incoming = SerialPort1.ReadExisting()
                If Incoming Is Nothing Then
                    Return "nothing" & vbCrLf
                Else
                    Return Incoming
                End If
            Catch ex As TimeoutException
                Return "Error: Serial Port read timed out."
            End Try
    
        End Function
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            For i As Integer = 0 To _
             My.Computer.Ports.SerialPortNames.Count - 1
                ComboBox1.Items.Add( _
                My.Computer.Ports.SerialPortNames(i))
            Next
        End Sub
    
        Private Sub AetherButton1_Click(sender As Object, e As EventArgs) Handles AetherButton1.Click
            If ComboBox1.Text = "" Then
                MsgBox("SELECT PORT !")
            ElseIf AetherTextbox1.Text = "" Then
                AetherTextbox1.Text = 9600
            Else
                If SerialPort1.IsOpen Then
                    SerialPort1.Close()
                End If
    
                Try
                    With SerialPort1
                        .PortName = ComboBox1.Text
                        .BaudRate = AetherButton1.Text
                        .ReadBufferSize = 500
                        .Parity = IO.Ports.Parity.None
                        .DataBits = 8
                        .StopBits = IO.Ports.StopBits.One
                        .Handshake = IO.Ports.Handshake.None
                    End With
                    SerialPort1.Open()
                Catch ex As Exception
                    MsgBox(ex.Message)
                End Try
            End If
        End Sub
    
        Private Sub AetherButton2_Click(sender As Object, e As EventArgs) Handles AetherButton2.Click
            Try
                SerialPort1.Close()
                MsgBox("Disconnect from COM")
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try
        End Sub
    
        Private Sub MonoFlat_Toggle1_ToggledChanged() Handles MonoFlat_Toggle1.ToggledChanged
            If MonoFlat_Toggle1.Toggled = False And SerialPort1.IsOpen Then
                SerialPort1.Write("LED 1 OFF")
    
            ElseIf MonoFlat_Toggle1.Toggled = True And SerialPort1.IsOpen Then
                SerialPort1.Write("LED 1 ON")
            End If
        End Sub
    
        Private Sub MonoFlat_Toggle2_ToggledChanged() Handles MonoFlat_Toggle2.ToggledChanged
            If MonoFlat_Toggle2.Toggled = False And SerialPort1.IsOpen Then
                SerialPort1.Write("LED 2 OFF")
    
            ElseIf MonoFlat_Toggle2.Toggled = True And SerialPort1.IsOpen Then
                SerialPort1.Write("LED 2 ON")
            End If
        End Sub
    
        Private Sub MonoFlat_Toggle3_ToggledChanged() Handles MonoFlat_Toggle3.ToggledChanged
            If MonoFlat_Toggle3.Toggled = False And SerialPort1.IsOpen Then
                SerialPort1.Write("LED 3 OFF")
    
            ElseIf MonoFlat_Toggle3.Toggled = True And SerialPort1.IsOpen Then
                SerialPort1.Write("LED 3 ON")
            End If
        End Sub
    
        Private Sub MonoFlat_Toggle4_ToggledChanged() Handles MonoFlat_Toggle4.ToggledChanged
            If MonoFlat_Toggle4.Toggled = False And SerialPort1.IsOpen Then
                SerialPort1.Write("LED 4 OFF")
    
            ElseIf MonoFlat_Toggle4.Toggled = True And SerialPort1.IsOpen Then
                SerialPort1.Write("LED 4 ON")
            End If
        End Sub
    End Class
    
  4. Press Start to run your aplication .

Jumat, 26 Oktober 2018

Tutorial for Making Software VBNET Arduino Part 1

Hi friend erwinproject, on part 1 this time we will discuss about making software with visual basic net. here I use visual studio, if you use visual basic 2010 the syntax is the same.
the initial step of making sure you have the software below.
Download Visual Studio 2012 [here]
we just started to manufacture the software:
  1. Create a new project file in visual studio, select windows application form and then write the name of the project then press OK.

  2. After that the blank form appears as shown below, then right-click on your project name in the Solution Exploer column, click add, then press Exiting Item, then enter the theme script below.

    [ Download Script Skin ] ( AeroV9, Mono, Valley )
  3. After you download the Script skin above. you enter into the visual studio do step no 2. after that click build on the tab above. then press rebuild as shown below.

  4. Then check in the Toolbox section new components will be ready to use. as shown below
  5. Then select the component that says "Valley Theme". to select the components, namely by drag and drop components.
enough of these part 1 software builds, for part 2 will definitely be updated periodically. thanks .

Senin, 22 Oktober 2018

Source Code Control Arduino dengan VB.NET


Hi friend erwinproject, this time I will share the visual basic application code to control the Arduino microcontroller. some features that I entered into this application. including having a login system at the beginning when running this application. The login system uses the database as a reference so that users can enter the core form. The database used is using "Microsoft Access". This software has 2 accesses, namely access as "user" and "admin". Software connects with Microsoft Access files in the .mdb file. There are 5 tabs in the main form:
  1. User tab, used to add, edit and delete users
  2. Information Tab: Contains how to use software.
  3. Control tab: to control the Arduino microcontroller
  4. Tab monitoring: for monitoring data from the Arduino microcontroller in real time
  5. Tab coding: for this tab only users with admin status can access this tab. this tab contains Arduino Coding.

for editing the source I use Visual Studio 2012. The source code link can be downloaded below:

if there are problems please comment below (politely) or through the contact form. thanks.

Tag :

  • Visual Basic Arduino
  • VBNET
  • Arduino VB