*VIDEO* Program react differently regards of POWER source - USB/BATTERY

Board reset because of unstable power.
Vin is parallel to power jack (on ordinary boards). Input power that goes to a voltage regulator. Your board is missing the power jack as you have a screw terminal instead (when switch is on).
If you separate power with the switch, you can still feed 6 to 23 volt to Vin, to power the system.