Go Down

Topic: Arduino VB serial communication  (Read 1 time) previous topic - next topic


I want to send 4 digit numbers from a VB programm to an arduino and controll a motor with it.
That's my code, but it doesn't work.

VB Code:

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.PortName = "com6"
        SerialPort1.BaudRate = 9600
        SerialPort1.DataBits = 8
        SerialPort1.Parity = Parity.None
        SerialPort1.StopBits = StopBits.One
        SerialPort1.Handshake = Handshake.None
        SerialPort1.Encoding = System.Text.Encoding.Default
    End Sub

    Private Sub ButtonON_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonON.Click

        Dim data As String
        Dim RPM1 As Double = RPM1 + 1
        Dim StartWinkel1 As Double = StartWinkel1 + 1
        Dim StopWinkel1 As Double = StopWinkel1 + 1

        data = ("R<RPM1>P<StartWinkel1>T<StopWinkel1>E")
        data = 0

Go Up