Go Down

Topic: Visuall Basic serial communication (Read 788 times) previous topic - next topic

tiwanacote

Hi!, I'm new... I would know how could be a code to receive in VB 2008 the following data throught USB (Serial) from Arduino

Serial.print('F');              
Serial.print(pulseCounter);          //  pulseCounter is an INT
Serial.print(1);  
Serial.print(1);    



I only get cut data in VB

ThankYou!!
Maxi

PaulS

Quote
I only get cut data in VB

What does this mean? What code is running on the Arduino? What VB code are you using?

mromani

Quote
I only get cut data in VB


My guess is your VB code is not printing out all the characters you are expecting to see, i.e. the characters print()ed by Arduino.

I have two suggestions: first, if you haven't done it already, open up the serial terminal and look at what exactly Arduino is sending.
Next, look carefully at how you are dealing with received serial data in VB. Remember the mechanism is the same as that on Arduino: the com port delegate (i.e. serial port callback function) is called whenever there is some data for you. You almost certainly have to insert an end-of-message marker on the Arduino side, and concatenate the received bytes on the VB side until that EOM char is seen.

I hope those 4 lines make sense :-)

mromani

Sorry, can't say much unless you provide the entire Arduino and VB code...

Go Up