Visual basic communications with Stamp
Chiles
Posts: 15
ok so originally I bought the Basic stamp homework board that connects to the 9-pin serial port and I wrote several programs with VB(visual basic 2008)·that talk to the basic stamp 2.·· Everything works fine.
Now I bought a new computer and a USB BOE with the basic stamp 2.· I am having trouble trying to get the programs to work now.· Just going into VB programs and changing the com1 to com4 has not fixed the problem - it has given a new error - incorrect programming of port com4?
Anyone know the fix?
·
Now I bought a new computer and a USB BOE with the basic stamp 2.· I am having trouble trying to get the programs to work now.· Just going into VB programs and changing the com1 to com4 has not fixed the problem - it has given a new error - incorrect programming of port com4?
Anyone know the fix?
·
Comments
Jeff T.
·
I've never done that.· Would you list·your simplest VB code that does that so I can try it myself.· Sorry I don't have the
answer to your question.
Ted Turanski
·
usb connection BOE:
when you run parallax program it tells you the port no. Can be even higher than com10,
rs232 is going to be com1-4
VB than must be programmed to receive and send this port
stamp programming is with SIN SOUT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
this is the way I pan one of my cameras from the internet - RS232 from security program
Post Edited (sahniana) : 11/29/2009 7:26:41 PM GMT
this is the stamp program to receive data or a single char- if its a "A" or not
' {$STAMP BS2}
' {$PBASIC 2.5}
' {$PORT COM1}
sData VAR Byte
Main:
SERIN 16, 16780, [noparse][[/noparse]sData]
IF (sData = 65) THEN GOTO Flack
END
Flack:
HIGH 14
PAUSE 900
LOW 14
PAUSE 900
HIGH 12
PAUSE 900
LOW 12
PAUSE 900
END
this program sends to VB program:
' {$STAMP BS2}
' {$PBASIC 2.5}
SEROUT 16, 16780, [noparse][[/noparse]"Hello Worldy"]
PAUSE 900
END
Now here is the VB2008 program to send and receive:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SerialPort1.Open()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = SerialPort1.ReadExisting()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
SerialPort1.Close()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
SerialPort1.WriteLine(TextBox1.Text)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If CheckBox1.Checked Then
TextBox1.Text = SerialPort1.ReadExisting()
End If
End Sub
End Class
I realize some stuff in the vb2008 program is set in the programing windows of VB2008, like baud rate - just use all defaults -good luck!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
this is the way I pan one of my cameras from the internet - RS232 from security program
thanks in advance, Chiles
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
this is the way I pan one of my cameras from the internet - RS232 from security program