How to connect flyback diodes on a h-bridge
From your breadboard diagram, one point stands out as missing: you have no bypass capacitors. The fast switching and inductive loads of the motor drivers will generate electromagnetic interference (EMI). Bypass capacitors are connected to between positive or negative rails and ground to stabilize the DC power rails and allow the currents causing EMI to be contained locally.

I would recommend using at least a 10uF-range electrolytic capacitor directly on the motor driver (H-bridge) power/ground pins, along with 0.1uF ceramic capacitors at the MCU and additionally at the motor driver. You don't want to put large capacitance on the motor driver output.

Additionally, you could put smaller ceramic capacitors (10nF to 0.1uF) directly on the motor, but these will slightly increase the power losses inside the motor driver. They are commonly connected as in this photo: