genielabs/serialport-lib-dotnet

Arduino Mega 2560 Response Problem

Opened this issue · 1 comments

Sorry for my English.

i'm using SerialPortLib for communicating with Arduino Mega 2560.
My code written like in Example usage manual section.
Sending data to serial is correct, but the event MessageReceived does not raise.

is any suggestions about my problem?
Thank you.

var serialPort = new SerialPortInput();
serialPort.ConnectionStatusChanged += SerialPort_ConnectionStatusChanged;
serialPort.MessageReceived += SerialPort_MessageReceived;
serialPort.SetPort("COM3", 250000);
serialPort.Connect();

foreach (var workContext in WorkContexts.Where(c=>c != null)) {
    var cmd = workContext.CommandFrame;
    var message = Encoding.UTF8.GetBytes(cmd);
    serialPort.SendMessage(message);
    Console.WriteLine($">> {cmd}"); 
}

...

I don't know much about the library, but your baud rate is 250,000.
ATmega doesn't support speeds above 115,200.