5V and Vin pins on Arduino I am working on connecting two Arduino boards (Arduino Uno &amp; Arduino Nano). I am trying to run a stepper motor  connected to Arduino Nano with two digital Pins on Arduino Uno to alter the direction of the stepper motor(BYJ48) connected to the arduino Nano.
While making connections I attached the pins as:

1] 5V  (UNO) -> 5V (NANO) &amp; GND (UNO) -> GND (NANO)

2] 5V (UNO)  -> 5in (NANO) &amp; GND (UNO) -> GND (NANO)

Both [1] &amp; [2] worked fine initially but I kept the arduino powered and tried toggling the Vin with 5v. Nothing went wrong in the beginning but later fumes started coming out and I dont know the reason why?
Was that because I kept the power on while toggling between Vin &amp; 5v ?
NOTE: besides the code and success in running the possible reason of fumes is much important here.
You can try software serial communication between the two boards. Any two digital pins of one board can be used as Rx and Tx, and make sure the roles of Rx and Tx are reversed on the other board. See the Software Serial library:
https://www.arduino.cc/en/Reference/SoftwareSerial