How do I read a string through the serial terminal in Visual Basic 2008?
I have a program in VB 2008 that will read the serial terminal and when it gets a string it will search for a web page using the string as the URL. It will then return the webpage. I have successfully sent strings in VB in the past, but I am now having trouble receiving one. Can I have some help on this?
Thanks,
Micro
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my new website!!
Use the Propeller icon!!
Follow me on Twitter! Search "Microcontrolled"
Thanks,
Micro
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my new website!!
Use the Propeller icon!!

Follow me on Twitter! Search "Microcontrolled"

Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Lots of propeller based products in stock at affordable prices.
@others: I'll post my VB code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my new website!!
Use the Propeller icon!!
Follow me on Twitter! Search "Microcontrolled"
Imports System.IO Imports Strings = Microsoft.VisualBasic ' so can use things like left( and right( for strings Public Class Form1 Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Integer) ' for sleep statements Dim WithEvents SerialPort As New IO.Ports.SerialPort ' serial port declare Dim OutPacket(0 To 2000) As Byte ' used for serial output bug with serial.write strings like chr(255) won't go out Dim InPacket(0 To 2000) As Byte ' for input bytes Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load SerialPort.PortName = "COM1" SerialPort.BaudRate = "9600" ' 9600 SerialPort.Parity = IO.Ports.Parity.None ' no parity SerialPort.DataBits = 8 ' 8 bits SerialPort.StopBits = IO.Ports.StopBits.One ' one stop bit End SubThere are several methods. I tend to set a timer going then periodically check if any bytes are available. Put them in an array and then turn them into strings later. Then you have to remember to disable the timer while running that code. This is an incomplete code fragment that sits in a Do..Loop
If SerialPort.BytesToRead = 0 Then Exit Do ' no more bytes BytesToRead = SerialPort.BytesToRead If BytesToRead > 2000 Then BytesToRead = 2000 SerialPort.Read(InPacket, 0, BytesToRead) ' read in a packetYou can also set interrupts to run when bytes come in. The above assumes that once you have read in n bytes you process them before reading in the next group.
Or am I completely off the mark? I'm not sure what you mean by "through the serial terminal"
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/propeller