Bonsoir tout le monde,

Je veux que le changements d'états de mes sorties arduino (supponsons une LED) soit transformé à une interface sous VISUAL STUDIO (version 2017 et langage :VISUAL BASIC).
J'ai ajouté en visual studio le composant SerialPort pour une communication série avec arduino. En gros, je veux afficher dans un textbox le msg "ejection" lorsque ma LED s'allume, mais rien n'est affiché dans ma textbox. Quelqu'un peut me corriger les codes que j'ai utilisé ??

Pour arduino, j'ai saisi le code suivant :

int LEDgreen = 8;

void setup() {
Serial.begin(9600);
pinMode(LEDgreen,OUTPUT);

}

void loop() {

(digitalRead(LEDgreen) == HIGH)

Serial.println("ejection"); }




Imports System.IO
Imports System.IO.Ports
Imports System.Threading

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


Dim SerialPort1 As New SerialPort("COM2")

'Sets port details
SerialPort1.BaudRate = 9600
SerialPort1.Parity = Parity.None
SerialPort1.StopBits = StopBits.One
SerialPort1.DataBits = 8
SerialPort1.Handshake = Handshake.None




SerialPort1.Open()

End Sub

Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived


Dim indata As String = SerialPort1.ReadExisting()

if indata="ejection" then
tbxSerial.Text = indata

End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click


Me.Close()

End Sub

Private Sub btnExit_Click_1(sender As Object, e As EventArgs) Handles btnExit.Click

End Sub
End Class