So, different grep, sorry
I have a working script here on debian squeeze, with multiplication included, but it seems I can't help you because the differences in our systems.
Just in case someone wants to try:
Code: Select all
#! /bin/sh
#
while :
do
WhatWeRead=$(grep -m 1 V /dev/ttyUSB0)
# Format reading
volt=`echo $WhatWeRead | cut -c -7`
amp=`echo $WhatWeRead | cut -c 10-16`
watt=`echo $WhatWeRead | cut -c 19-25`
wattH=`echo $WhatWeRead | cut -c 28-34`
echo data20 $(printf "%0.0f" $(echo "$volt*100"|bc))"\n"data21 $(printf "%0.0f" $(echo "$amp*100"|bc))"\n"data22 $(printf "%0.0f" $(echo "$watt*100"|bc))"\n"data23 $(printf "%0.0f" $(echo "$wattH*100"|bc));
sync
sleep 30
done
