TatsuTechnologies
Published © CC BY-NC

Arduino with Vb.net GUI control

This project is related to Arduino and Vb.net.

IntermediateWork in progress3,024
Arduino with Vb.net GUI control

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
LED (generic)
LED (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Visual Studio 2015
Microsoft Visual Studio 2015
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Materia 101
Arduino Materia 101

Story

Read more

Code

Code

C#
int ledPin = 13;
int led1Pin = 12;

void setup() {

Serial.begin(9600);

pinMode(13, OUTPUT);

digitalWrite(13, LOW);

pinMode(12, OUTPUT);

digitalWrite(10, LOW); //turn off LED1

}

void loop()

{

while (Serial.available() == 0);

int val = Serial.read() - '0';

if (val == 1)

{

digitalWrite(12, HIGH);

}

else if (val == 0) //

{

digitalWrite(12, LOW); }

else if (val == 2)

{

digitalWrite(13, HIGH);

}

else if (val == 3)

{

digitalWrite(13, LOW);

}

else

{

//val = val;

}

Serial.println(val);

Serial.flush(); // clear serial port

}

vb.net code

VB.NET
Imports System.IO
Imports System.IO.Ports

Imports System.Threading

Public Class Form3

Shared _continue As Boolean

Shared _serialPort As SerialPort

Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load SerialPort1.Close()

SerialPort1.PortName = "com3"

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 Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click End

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click SerialPort1.Open()

SerialPort1.Write("1")

SerialPort1.Close()

End Sub

Credits

TatsuTechnologies

TatsuTechnologies

1 project • 1 follower
Contact

Comments

Add projectSign up / Login