Waiting for a signal - mine not working
07 Mar 2013 23:09 #31037
by mariusl
Regards
Marius
www.bluearccnc.com
Replied by mariusl on topic Waiting for a signal - mine not working
Thanks a lot John, it is working now. I dont think I will forget this one too soon.
Regards
Marius
www.bluearccnc.com
Please Log in or Create an account to join the conversation.
14 Mar 2013 13:56 #31387
by wizard69
Maybe it is me but I don't see how this could ever work! My BASH is rusty but it looks like you are comparing $2 to itself thus always exiting.
Replied by wizard69 on topic Waiting for a signal - mine not working
Hi
I am using this piece of code to read a signal and then wait for it to change:
M100#!/bin/sh halcmd sets ladder_in 1 ~/linuxcnc/nc_files/waitfor ladder_out 1 halcmd sets ladder_in 0
waitfor#!/bin/bash if [ $# != 2 ]; then echo usage: $0 SignalName DesiredValue exit 1 fi signal=$1 value=$2 while :; do set -- $(halcmd -s show sig $signal) if [ x"$2" == x"$value" ]; then exit 0 fi sleep 1 done
It looks like the code never enters the loop but I have no way of telling. It will exit and turn the signal of right away.
Maybe it is me but I don't see how this could ever work! My BASH is rusty but it looks like you are comparing $2 to itself thus always exiting.
Please Log in or Create an account to join the conversation.
14 Mar 2013 17:17 #31396
by mariusl
Regards
Marius
www.bluearccnc.com
Replied by mariusl on topic Waiting for a signal - mine not working
The HAL command actually returns a string of which the second value is compared to the second passed parameter. I hope it makes sense. anyway, the code works as per the above posts
Regards
Marius
www.bluearccnc.com
Please Log in or Create an account to join the conversation.
Time to create page: 0.059 seconds