Help needed with combining two sketches together

What's with the duplicate pinMode calls?
Did you mean digitalWrite?

Edit: re-read sketch. You don't need pinMode for PWM pins that are used with analogWrite.

Re-edit, but now I see you're analog and digital writing to same pins. That's not sensible.

Your definition of "do nothing" differs hugely from mine.