Difference between revisions of "Template:Networking rut955 manual input output cli"

From Teltonika Networks Wiki
 
Line 37: Line 37:
 
As seen in the example above, you can change the value of an output by using the <i>invert</i> command, which simply turns the current value of the specified output into its opposite state.
 
As seen in the example above, you can change the value of an output by using the <i>invert</i> command, which simply turns the current value of the specified output into its opposite state.
 
----
 
----
To get the value of the analog input use the <i>analog_calc</i> command. For example:
+
To get the value of the analog input use the <i>cat /sys/class/hwmon/hwmon0/device/in0_input</i> command. Router will show voltage value in '''mV'''. For example:
  
 
<pre>
 
<pre>
root@Teltonika:~# analog_calc
+
root@Teltonika:~# cat /sys/class/hwmon/hwmon0/device/in0_input
7.2V
+
950
 
</pre>
 
</pre>

Latest revision as of 08:18, 22 October 2019

You can control and monitor input and output values via a command line interface (CLI) with the gpio.sh command. You can execute this command without any additional options to get usage syntax examples:

root@Teltonika:~# gpio.sh
GPIO control aplication
        Usage: /sbin/gpio.sh <ACTION> <NAME>
        ACTION - set, clear, get, export, invert, dirout, dirin
        NAME - SIM      DOUT1   DOUT2   DIN1    DIN2    MON     MRST    SDCS    RS485_R

Where:

  • DOUT1 - Digital OC output
  • DOUT2 - Digital relay output
  • DIN1 - Digital input
  • DIN2 - Digital galvanically isolated input

For example, to get the status of the digital OC output use the following command:

root@Teltonika:~# gpio.sh get DOUT1
0

The return value 0 means that the output is in Inactive (High level), i.e., OFF.

You can turn it ON (Active (Low level)) by setting its value to 1:

root@Teltonika:~# gpio.sh invert DOUT1
root@Teltonika:~# gpio.sh get DOUT1
1

As seen in the example above, you can change the value of an output by using the invert command, which simply turns the current value of the specified output into its opposite state.


To get the value of the analog input use the cat /sys/class/hwmon/hwmon0/device/in0_input command. Router will show voltage value in mV. For example:

root@Teltonika:~# cat /sys/class/hwmon/hwmon0/device/in0_input
950