Modifying a sketch

but isnt the val=0 and val=1 the High and LOW for digital pin? digitalWrite(2, val);

You tell US. You know what you are sending, and why. What do you intend to send for the next pin? What IS the next pin?