Arduino and VB2008 communication

Im trying to send a numerical digit to the arduino via usb cord using a custom visual basic app. So far I have sent the string over the usb cord and converted it to an integer on the arduino. The problem I'm having is I can only recieve one number at a time. So if I send a three digit number like 123, on the arduino i get 1, 2 and 3. How can I make a variable on the arduino = 123 again?

Assuming you're sending ASCII bytes, don't forget to first convert them to digits (i.e. subtract '0') before performing the operation Richard Crowley mentions above. Another option is to just send the actual value rather than an ASCII representation of the value. That is to say, instead of sending the three bytes:

'1', '2', '3'

send the single byte:

123

Of course this will only work for values from 0 to 255. You can send higher values if you break them up into multiple bytes.

  • Ben

Thanks for quick reply. Its working smoothly now.