Use AssignFile, otherwise it thinks you're calling the Assign method of the form.
Thank you @Wallaby, your fix works. I see the RX led flicker on the nano but the led on pin 13 does not stay on. It flickers though. When I test my code in the Arduino sketch using the serial monitor everything works as expected. Any ideas?
You're inflicting several problems upon us here.
First, this partly duplicates your earlier thread at
https://forum.lazarus.freepascal.org/index.php/topic,68606.msg530579.html which you abandoned.
Second, you've not given the community a testable project for this one. Now as it is Wallaby et al. have given you the correct answer, but I think it will be useful for you to consider the actual cause.
If you'd posted a proper project, it would be apparent that in the file causing the error you had imported other units which (we can reliably speculate) bring in implementations of Assign() other than System.Assign(), and that these are for some reason "closer" to the point of failure in a way that prevents polymorphism from telling the compiler which one to use.
And what is actually preventing the usual polymorphism from working? This:
procedure TForm1.btnTurnOnLedClick(Sender: TObject);
...
Assign(f, '/dev/ttyUSB0'); // Or 'COM3' on Windows
You're calling Assign() in the context of a class TForm1. That descends from TForm... and up at the top of the unit is would be apparent that you've imported Forms.
The compiler could, possibly, have made sense of that. But it hasn't (and frankly I don't blame it), because TForm.Assign() is hiding all other declarations of Assign().
And /that/ is why you have to use either AssignFile() or System.Assign().
MarkMLl