How to check that the given pin(if it's pin3) is high or low
if (digitalRead(pinX) == HIGH){
// do something
}
or
if (digitalRead(pinX) == LOW){
// do something
}
Pretty basic. Suggest you do some reading under the Learning tab as a next step.