This is the sequence. It is only when the data is send for the second time it reset.
It works fine when I send it only once.
1] I power up the Arduino and wait 5 seconds
2] I start the VB app which opens the serial communication automatically at comport 10 once via the USB port and wait 5 seconds
3] VB app has read the EEPROM data into the text boxes and when I move the trigger of the controller I see the trigger data live updated in the VB APP. So we have continously updating of the controller data to the VB APP.
4] I set the new settings in the VB APP and press the button send data to controller.
5] I wait 3 seconds and see that the new values are updated in the text boxes of the VB APP.
6] I move the trigger of the controller I see the trigger data live updated in the VB APP.
So even if we receive and send data once we still have connection.
7] Now I once again press the VB app button and send data to the controller.
8] Now the Arduino resets or hangs or what ever happens at that point.
It always reset at the 2nd time never at the first.
VB code for sending the data to the controller
Private Sub cmdSendDataToController_Click()
strOutput = cmbdeadbandX.Text & "," & cmbregBrake.Text & "," & cmbregbrakeState.Text & "," & cmbregHy & "," & cmbspeedBrake.Text & "," & cmbspeedbrakeState.Text & "," & cmbModelNumber.Text & ":"
MSComm1.Output = strOutput
vb code that opens the port at formload of the VB app
Private Sub cmdComport_Click()
On Error Resume Next
If .PortOpen Then .PortOpen = False
.CommPort = cmbComport.Text
.Settings = "9600,n,8,1"
.DTREnable = True
.RTSEnable = True
.RThreshold = 1
.SThreshold = 0
.PortOpen = True
If MSComm1.PortOpen = False Then
MsgBox "No USB device available or wrong Com Port number", vbCritical, "Please check!"