Hi
I hacked my yun to replace the leonardo by a Arduino mega. I use upload via ttyACM0 and that works all great.
However when I run the reboot command in openwrt it doesn't work because the mod to reset the leonardo does not work to reset the mega (I tried to connect the reset line to the mega but that didn't work)
So basically the leonardo is reset (who is not using ttyATH0) but not the mega (that is using ttyATH0) so the boot process of openwrt does get interrupted.
I was wondering whether there is a easy command to reset the mega using ttyACM0 that I can put in reset-mcu.
A search didn't reveal anything trivial.
void setup() {
// put your setup code here, to run once:
int pin=12;
pinMode(pin, INPUT);
digitalWrite(pin, LOW);
pinMode(pin, OUTPUT);
delay(100);
pinMode(pin, INPUT);
}
via a 1K resistor, a Yun Digital Pin (for example pin12) to the Mega Reset Pin, connect both board ground to ground.
sonnyyu
Thanks for the response. However I'm looking for code to run on openwrt that will reset a mega that is connected to ttyACM0.
Best regards
Jantje
@sonnyyu
Ach now I get it. I'd prefer a Linux command though. As The hardware is finished and the mods I did make it more difficult to upload to the leonardo.
@arbor
I have some battery issues (another 500 euro down the drain =( ) so I'll test as soon as I have the hardware running again.
placed some other batteries so I could do some testing.
cat /dev/ttyACM0
works but I have to press ctrl+C because the stream isn't closing.
But this set me to think and I came up with this solution: head -c 0 /dev/ttyACM0
This works like an charm and probably works on any linux.
Why it works?
Head opens a file and prints the first lines. so head /dev/ttyACM0
may work if the arduino is printing to Serial. However mine is not and the delay may become to big.
head -c 0 /dev/ttyACM0
The -c 0 (zero no capital O) says to print 0 characters. So this will open the file and close it.