High voltage drop on Nano outputs caused by sketch

The OP is quite confusing in labeling pins and signals as inputs or outputs. The setup() code reveals the really used setting.