AppleScript too slow

Hello there,
perhaps yes once someone help ...
I have a mega 2560 of from an external device to an indefinite
Time receives a pulse.
If this is processed, then he has the following format:
"104692"

This "104692" is transferred exactly to a 1x MacMini.
This works with any terminal program and also with the monitor
Arduino IDE.

Only in AppleScript I do not get it out.
I have attached the script once. The is very slow and the "104692"
are as:
"10"
"4692"
transfer.

The AppleSchript to do nothing more than the port of the Arduino in a
Query loop and the received "104692" Write in a variable.

That must go yet faster with AppleScript? The script brakes are self- and
also the MacMini completely out ...
Many thanks for the help.
Greeting and fun
Andreas

AppleScript too slow


set onMode to false
set use_port to "/dev/cu.usbmodem411"
repeat until (get serialport list) contains use_port
	delay 3
end repeat
if (get serialport list) contains use_port then
	set onMode to true
	set myPort to serialport open use_port bps rate 9600 data bits 8 parity 0 stop bits 1 handshake 0
	delay 1
	if myPort is equal to -1 then
		display dialog "could not open port"
	end if
	
	try
		repeat
			set x to serialport read myPort
		end repeat
	end try
	
end if

end
serialport close myPort
end

Would you not be better off asking for help with AppleScript in an AppleScript forum ?

Hello there,
perhaps, here, there are more people that deal with Arduino and AppleScript
knowledgeable.
Greeting and fun
Andreas

here, there are more people that deal with Arduino and AppleScript

You say that your Arduino code is working OK so you do not appear to have an Arduino problem. The number of people on here that are experienced in using AppleScript is likely to be very small whereas on an AppleScript forum it will be much higher.

Hello there,
I can see where the road goes ...
Thank you for the effort.
Greetings and thanks
Andreas