int p1 = 1;
This implies you are trying to use pin 1 as an output. This is used by the serial communications along with pin 0. Pick another pin.
int p1 = 1;
This implies you are trying to use pin 1 as an output. This is used by the serial communications along with pin 0. Pick another pin.