Hello everyone,
I wrote a simple program on the arduino interface that turns on the LED when the user sends 'a' to the serial port, and turns off the LED when the user sends 'b' to the serial port.
if (Serial.available() > 0) {
int incomingByte = Serial.read();
if (incomingByte == 'a') {
digitalWrite(ledPin, HIGH);
}
if (incomingByte == 'b') {
digitalWrite(ledPin, LOW);
}
My program works fine using the arduino interface serial monitor. However now I would like to send the characters using c#.
in c# I wrote a simple program
serialPort1.PortName = "COM13";
serialPort1.BaudRate = 9600;
serialPort1.Open();
if (serialPort1.IsOpen) {
serialPort1.WriteLine("a");
}
after running this c# code i cant get the led to turn on. Any ideas how I can get this to work?
Thanks!!!