bash -> arduino


Author Message
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4378
Posted: 12:26pm 06 Jun 2020      

It may be due to the many opens.

This might help, though it doesn't help that the device has already been opened and closed by the stty.


for i in {1..1000}
do
echo $i >/dev/tty
echo "dwrite 13,1"
sleep 0.5
 echo "dwrite 13,0"
sleep 0.5
done >/dev/ttyUSB0


Sorry if you need parens (*) to use a subshell.

(*) around the whole for loop.

I've had to change the echo $i to compensate for otherwise using ttyUSB0.

There are cunning (?) ways to use redirection to tweak this but see if it helps at all.
BTW, sleep used to need an integer but a float now seems OK.

I'm wondering why you need sudo, as you appear to have permissions anyway.  (Yes, commonly via dialout or the like.)

John
Edited 2020-06-06 22:27 by JohnS