I am trying to communicate with a Pro Micro 3.3V 16MHz board with Visual studio 2010 through visual basic.
I can send data fine but can not recieve. I have tried 3 example VB/Arduino programs but nothing.
Here it the VB and Arduino source code for the example that I have most recently tried.
Arduino Code
int incomingByte = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
if (Serial.available() > 0) \
{
incomingByte = Serial.read();// read the incoming byte:
// say what you received in ASCII
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}
}
VB Code
Public Class Form1
Dim WithEvents SerialPort As New IO.Ports.SerialPort
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ConnectSerial()
End Sub
Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
If SerialPort.IsOpen Then
SerialPort.Write(txtSend.Text)
Else
ConnectSerial()
SerialPort.Write(txtSend.Text)
End If
End Sub
Private Sub ConnectSerial()
Try
SerialPort.BaudRate = 9600
SerialPort.PortName = “COM7” 'notice how the ports are named? they HAVE to have COM in front of the number
SerialPort.Open()
Catch
SerialPort.Close()
End Try
End Sub
Delegate Sub myMethodDelegate(ByVal