Community discussions

MikroTik App
 
oguruma
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 83
Joined: Sat Jun 04, 2022 8:55 pm

RS-232 input/output for scripting?

Wed Apr 26, 2023 11:31 pm

Is it possible to use the RS-232 to run various scripts? For example, if I connect a button/switch to pins on the RS-232, can I use that to trigger a script to run?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: RS-232 input/output for scripting?

Thu Apr 27, 2023 12:01 am

No.
 
r00t
Long time Member
Long time Member
Posts: 672
Joined: Tue Nov 28, 2017 2:14 am

Re: RS-232 input/output for scripting?

Thu Apr 27, 2023 2:34 am

Well, short answer is NO...

... but there is a way to accomplish what you want:
Use arduino to interact with the console directly (log in, issue command, log out). Can use special account with restricted access just for what you want to do.

For more complex things it's even possible to have full access to the API this way:
  • Configure PPP server on ROS, give it static IP and enable API access from that IP
  • On arduino (or other platform of your choice) have PPP client that "dials in" the link to RB over serial "null modem" cable
  • This way arduino can make GET/POST requests to REST API
  • And you can send pretty much any commands/change anything on the router from your microcontroller
There is "PPPOSClient" library you can use (https://github.com/levkovigor/ppposclient), made for use with GSM modems, but you can easily strip all of the modem stuff and go straight to establishing PPP connection.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: RS-232 input/output for scripting?

Thu Apr 27, 2023 2:58 am

Short answer is "No." because if the user wanted to buy something else instead of saving money and using RS232 pins with a simple button,
he didn't even ask the question...

Who is online

Users browsing this forum: No registered users and 16 guests