Use Arduino Serial Port

Hello,

I try to communicate with mAirList via the COM Port of an Arduino, but the result isn’t the expected one. The text doesn’t seem to be received at one time.

arduino-mairlist
Arduino code:

void setup()
{
    Serial.begin(9600);
}

void loop()
{
    Serial.print("TALKTIMER START");
    delay(5000);
}

Background Script:

procedure OnLoad;
begin
  ComPort('COM3').SetParameters(9600, 8, 'N', 1);
  ComPort('COM3').Open;
end;

procedure OnUnload;
begin
  ComPort('COM3').Close;
end;

procedure OnSerialData(Port: string; Data: AnsiString);
begin
  SystemLog(Data);
  if Data = 'TALKTIMER START' then begin
    SystemLog('TALKTIMER START');
    ExecuteCommand(DATA);
  end;
end;

Where did I make a mistake? Thanks for your help.

Did you respect following instruction?

(Found here.)
 

Configured regards

TSD

I’m not a programmer, but I used “Serial.println” when I made a simple keypad. I presume this gives the CR element.

Which command should I send from the arduino?

Serial.println("PLAYER 1-1 START");
Serial.print("PLAYER 1-1 START\r");
Serial.print("PLAYER 1-1 STARTCR");
Serial.print("PLAYER 1-1 START#13");

All these commands are well displayed on the system log but in several lines (as in the illustration on my first post), and none are executed.

procedure OnSerialData(Port: string; Data: AnsiString);
begin
  SystemLog(Data);
  if Data = 'PLAYER 1-1 START' then begin
    SystemLog('PLAYER 1-1 START');
  end;
  if Data = 'PLAYER 1-1 START\r' then begin
    SystemLog('PLAYER 1-1 START');
  end;
  if Data = 'PLAYER 1-1 STARTCR' then begin
    SystemLog('PLAYER 1-1 START');
  end;
  if Data = 'PLAYER 1-1 START#13' then begin
    SystemLog('PLAYER 1-1 START');
  end;
end;

None of this works.

I’m not programmed either, thanks for your help.

Have you tried to use the remote-control „serial port“ in the config of mairlist? Then you don‘t need to use your script, because mairlist execute the serial commands by itself, provided correct settings (e.g. baud rate, port, etc.).

I am using arduino via serial and mairlist for years now and I think I just coded the commands via Serial.println(). But I can check my code again later for you, if that might help.

Have a nice day!
Stefan

Yes, please use the “Serial port” remote control.

The script from the original post processes raw data coming in from the port, so you have to buffer it yourself, split lines etc.

The “serial port” remote will do that for you. Just make sure you terminate each command a CR character (ASCII 13).

This is actually much easier to use with the “Serial port” remote control.

Thanks a lot for your help !