Public Sub Form_Open()
StatoSeriale.Background = Color.Red
SerialPort1.Open
End
Public Sub AccendiBottone_Click()
StatoBottone.Text = "ON"
StatoBottone.Background = Color.Green
SerialPort1.Write = "1"
End
Public Sub SpegniBottone_Click()
StatoBottone.Text = "OFF"
StatoBottone.Background = Color.Red
SerialPort1.Write = "0"
End
Public Sub AvvioSeriale_Click()
StatoSeriale.Background = Color.Green
StatoBottone.Enabled = True
End
un errore è cannot open serial port
e l'altro è unknow symbol write serial port
ok ma quando apro la porta seriale
serialport1.open
mi dice
cannot open serialport (5)
sisi però ti faccio leggere il codice .
Public Sub _new()
End
Public Sub Form_Open()
StatoBtnSeriale.Background = Color.Red
End
Public Sub AccendiBottone_Click()
If SerialPort1.Status == Net.Active
StatoBottone.Text = "ON"
StatoBottone.Background = Color.Green
Write #SerialPort1, "1"
Else
Message("porta seriale non abilitata")
Endif
End
Public Sub SpegniBottone_Click()
If SerialPort1.Status == Net.Active
StatoBottone.Text = "OFF"
StatoBottone.Background = Color.Red
Write #SerialPort1, "0"
Else
Message("porta seriale non abilitata")
Endif
End
Public Sub AvvioSeriale_Click()
If SerialPort1.Status == Net.Inactive
SerialPort1.Open
StatoBtnSeriale.Background = Color.Green
StatoBottone.Enabled = True
StatoBtnSeriale.text = "Enabled9600Baud"
Else
AvvioSeriale.Enabled = False
Endif
End
Public Sub SerialPort1_Read()
End
Public Sub StatoBtnSeriale_Click()
End
ti spiego quando clicco su accendi senza abilitare la seriale mi da il messaggio , ma dopo che abilito la seriale devo cliccare 2 volte su accendi per farlo accendere e non una sola volta come mai?
io con arduino usavo:
Print #SerialPort1, "1"; Chr$(13); Chr$(10);