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.
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;
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;
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.