bash -> arduino


Author Message
Volhout

Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 6103
Posted: 08:32am 07 Jun 2020      

Thank you all for helping me with suggestions.
I tried each one of them and had not the success I hoped for.
But JohnS's suggestion made me think about processes.

I found a working solution, not by tweaking the stty command, or the opening and closing of the serial port, but by simply opening putty in the background (something I did manual to make it work). I don't even have to use the stty anymore since Putty has taken care of that.

So... this works....

#!/bin/bash

#open serial port using pre configured Putty in the background
putty -load "Arduino" &

#let arduino wake up
sleep 3

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


Thank you all for your help, it was your suggestiions that lead to a solution.
It may not be a "production solution" but for my test setup it is fine.

Regards,

Volhout.