I am working on connecting two Arduino boards (Arduino Uno & 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) & GND (UNO) -> GND (NANO)
2] 5V (UNO) -> 5in (NANO) & GND (UNO) -> GND (NANO)
Both  &  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 & 5v ?
NOTE: besides the code and success in running the possible reason of fumes is much important here.