To improve the user experience on this site we use cookies. I agree | I disagree

How can I read analogue input in a script?

In category Routers .


You can fill your variable

VAL1=`/usr/bin/io get an1`

 

and then use it in your condition

VAL=`/usr/bin/io get an1`
 if [ $VAL -gt 500 ]; then
    echo="Value is "$VAL
 else
    echo="Value is less then 500"
 fi

 

or you can read the analogue input directly in condition.

if [ `/usr/bin/io get an1` -gt 500 ]; then
    echo="Value is "$VAL
else
    echo="Value is less then 500"
fi

 

 

To the FAQ overview