Let's Make Robots!

Help with serial data out and VB

I am looking for a small snippit of code to show me how I could send a byte or two from Virtual Basic out to my picaxe. I am planning on using my Picaxe sync cable as the serial port and I can find the com port number. Would anyone be so kind as to give me a hand?

P.S. I am asking this for another guy.

Chris

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

If using VB is not a firm requirement, I've been having good success using RobotBASIC to communicate back and forth with a PICAXE 20X2 project.  RobotBASIC is a free download from http://www.robotbasic.org/.  There is a whole section of the help file dedicated to serial comms and there are examples at the website showing code for Basic Stamps and Propeller.

Here is a simple program I use to send strings back and forth over COM 4.  The first few lines are to configure the port and setup a handshake, and then the code just toggles between receive and send:

CommPort = 4
setcommport CommPort,br9600,8,pNone,sbOne,fcNone
ClearSerBuffer
Print "Terminal"


shake:
 thisChar = "R"
 serout thisChar
 delay 20
 SerIn s
 if s <> "R" then goto shake

main:              
 checkserbuffer n
 if n>=1
  delay 1000
  SerIn s
  print s
 else
  goto main
 endif 
 
 input "?", u

 for i=1 to length(u)
  thisChar = char(GetStrByte(u,i))
  serout thisChar
  delay 10 
 next

goto main

There is a C# project about it you can look at. It should be easily translated to VB.NET.

http://www.codeproject.com/KB/system/rs232ThreadSafe.aspx

Other admins, delete if you want...I just felt I had to post this as I was in and out of the convo.....