RouterOS Italia

Versione completa: [Mikrotik] Sending text out over a serial port
Al momento stai visualizzando i contenuti in una versione ridotta. Visualizza la versione completa e formattata.
Sometimes there's a need to send out some (short) text over a serial port to control other devices.

As RouterOS doesn't (yet?) provide a native command to do that, you can work around with the following little script:
Codice:
/interface ppp-client add name="scripttemp" dial-on-demand=no port=serial0 \

Codice:
modem-init="I am the string" null-modem=yes disabled=no

Codice:
:delay 1

Codice:
/interface ppp-client remove [/interface ppp-client find name="scripttemp"]


The following assumptions were made:
  • We want to use serial port "serial0"
  • We have configured the serial port to match the other devices' setup (baud-rate etc.)
  • serial0 (or whatever port you use) is not used by RouterOS serial-console
The script sends the text configured as modem-init string out over the serial port when run.
So in the example above, it would send "I am the string" (without the quotes).