I have two arduino mega2560 and using the basic master-slave codes
The code work perfectly fine as long as the both arduino boards are remain connected to USB, after uploading their codes.
Issue 1: When I remove the USB from master-arduino and power the board with external power, the slave-arduino stop receiving data (as seen in serial monitor) - very STRANGE! or is it the master-arduino stopped sending data!
Issue 2: I understand that the above code requires slave-arduino to stay connected to USB. So, I changed the code a little, instead of serial write, it will now set a digital pin (say 22) high when receive data from master. After uploading the code, I remove the USB and power the slave-arduino through power plug. I found that, its not receiving any data even when master-arduino is connected to USB!
My ultimate aim is to have both the arduinos powered by external power-plug (I am using 9V battery) and can work as master-slave (without the USB plugged in).
My ultimate aim is to have both the arduinos powered by external power-plug (I am using 9V battery) and can work as master-slave (without the USB plugged in).
If the above does not solve the issue, you will have to show your sketches.
I've just tested it using two Unos and it works perfectly. (modified slave code to toggle a LED in the slave event). Master powered via barreljack with 12V, slave powered via USB with a cellphone charger. Next powered the slave from the master and that also worked.