TDPmurdock
Gebruiker
- Lid geworden
- 6 feb 2008
- Berichten
- 35
uhm, als ik in het hoofdvenster knoppen bedien, kan da de waardes in het "statistics" venster beinvloeden, mag idd ook op de achtergrond staan...
Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
Channel 1 Commands
ASCIICharacter HexValue Description Return / Comments
1 0x31 Dig Out – High Nothing returned
Q 0x51 Dig Out – Low Nothing returned
A 0x41 Digital Input Returns 0 or 1
Z 0x5A Analog In Returns measured voltage
9 0x39 Temperature Returns current temperature
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Control.CheckForIllegalCrossThreadCalls = False
Try
With Input2
.PortName = "COM4"
.BaudRate = 115200
.DataBits = 8
.ReadTimeout = 1000
.StopBits = IO.Ports.StopBits.One
.Parity = IO.Ports.Parity.None
End With
Input2.Open()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub input2_DataReceived(ByVal sender _
As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
Handles Input2.DataReceived
Dim ontvangenTekst As String
ontvangenTekst = Input2.ReadExisting()
Label1.Text = ontvangenTekst
End Sub
input2.Write("A")
dim lastOne as string
dim NewOne as string
[COLOR="SeaGreen"]'''''''''''''''''''''''''''''''''''''''[/COLOR]
LastOne = NewOne
NewOne = [COLOR="SeaGreen"]'hier de code waarmee je leest in een functie ofzo? [COLOR="DarkGreen"]*edit* is dat deze? Input2.ReadExisting()[/COLOR] [/COLOR]
if newOne <> LastOne then
msgbox "er is een verandering! " & vbcrlf & "namelijk: " & LastOne & " is veranderd in " & NewOne
end if
Sub Test
Static x as integer
x = 3
End Sub
Private Sub input2_DataReceived(ByVal sender _
As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
Handles Input2.DataReceived
Strinput2 = Input2.ReadExisting()
End Sub
Private Sub controlbases()
If Strinput2 = 0 Then
Timer1B.Stop()
Timer1A.Start()
LblBase1.BackColor = Color.Red
Else
If Strinput2 = 1 Then
Timer1A.Stop()
Timer1B.Start()
LblBase1.BackColor = Color.Blue
End If
End If
End Sub
De conversie van tekenreeks naar type string is ongeldig.
[COLOR="blue"]dim[/COLOR] xBla [COLOR="blue"]as[/COLOR] [COLOR="Blue"]variant[/COLOR]
[COLOR="seagreen"]'1.) LEEG[/COLOR]
Strinput2 = "" [COLOR="seagreen"]'je kon ook 'Nothing' gebruiken geloof ik[/COLOR]
[COLOR="SeaGreen"]'2.) VUL[/COLOR]
Strinput2 = Input2.ReadExisting()
wat moet ik hier mee proberen? en waar?Code:[COLOR="blue"]dim[/COLOR] xBla [COLOR="blue"]as[/COLOR] [COLOR="Blue"]variant[/COLOR]
tried this:
Code:Private Strinput2 As String ------- Private Sub input2_DataReceived(ByVal sender _ As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _ Handles Input2.DataReceived Strinput2 = "" Strinput2 = Input2.ReadExisting End Sub Private Sub controlbases() [COLOR="Red"]If Strinput2 = 0 Then[/COLOR] Timer1B.Stop() Timer1A.Start() LblBase1.BackColor = Color.Red Input2.Write("A") Else If Strinput2 = 1 Then Timer1A.Stop() Timer1B.Start() LblBase1.BackColor = Color.Blue Input2.Write("A") End If End If End Sub
maar krijg nog steeds deze fout (bij de rode zin) :
Invalid caused exception was unhandled:
De conversie van tekenreeks naar type Double is ongeldig.
... = 0
Private Strinput2 As String
-------
Private Sub input2_DataReceived(ByVal sender _
As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
Handles Input2.DataReceived
Strinput2 = ""
[COLOR="SeaGreen"]'... meer stuff[/COLOR]
invalidcastexeption was unhandled
De conversie van tekenreeks 0 0 naar type Double is ongeldig.
Private Strinput2 As String
-------
Private Sub input2_DataReceived(ByVal sender _
As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
Handles Input2.DataReceived
Strinput2 = ""
Strinput2 = Input2.ReadExisting
End Sub
Private Sub controlbases()
If clng(Strinput2) = 0 Then
Timer1B.Stop()
Timer1A.Start()
LblBase1.BackColor = Color.Red
Input2.Write("A")
Else
If clng(Strinput2) = 1 Then
Timer1A.Stop()
Timer1B.Start()
LblBase1.BackColor = Color.Blue
Input2.Write("A")
End If
End If
End Sub
'input data received'
Private Sub input_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles Input.DataReceived
[COLOR="Red"] strinput1 = Asc(Input.ReadExisting())[/COLOR]
TextBox2.Text = strinput1
End Sub
Private Sub controlbases()
If strinput1 = 48 Then
Timer1B.Stop()
Timer1A.Start()
LblBase1.BackColor = Color.Red
Else
If strinput1 = 49 Then
Timer1A.Stop()
Timer1B.Start()
LblBase1.BackColor = Color.Blue
End If
End If
End Sub
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.