serial port - Bash read from ttyUSB0 and send to URL -
i bash novice , struggling putting together.
what trying is:
1) set port (stty)
2) read dev/ttyusb0 - data should 000118110000101 (cat or gawk?)
3) set read data variable eg data , create url eg http://domain.com/get_data.php?data=$data
4) load url wget?
5) wait more data ttyusb0 (polling or loop?)
i have tried php dio extention work not reliable because stops/starts reason.
any suggestions appreciated, great-full if advise best way this
thanks
brent
this used.
#set permisions sudo chmod o+rwx /dev/ttyusb0 #!/bin/bash # port setting stty -f /dev/ttyusb0 cs7 cstopb -ixon raw speed 1200 # loop while [ 1 ]; echo 'loading...' read=`dd if=/dev/ttyusb0 count=22 | sed 's/ //g'` echo $read wget http://localhost/bashtest/test.php?signal=$read echo '[press ctrl + c exit]' done
Comments
Post a Comment