Improved Logic Gates.

mmcp42:
I suspect your AND will return HIGH if both inputs are HIGH or both inputs are LOW
not sure that's what I'd expect

the comments in setup are confusing
pinMode(4,INPUT); // pin 3
pinMode(3,INPUT); //pin 2
pinMode(0,OUTPUT); //pin 5

a) I would use #defines
b) why don't the numbers match!

IMOH
YMMV

Originally, I wired it up completely different to use different pins then changed my mind to use a PWM channel over a standard Pin out.
Defines... yes but i've really not delved that far into the language yet.

As for the AND gate

Cool, i'll fix it cheers