This is wrong:
if (sample < sinewave_length&&PressStatus=1) {
It would be best to parenthesize the two separate conditions but the real problem is that '=' is assignment, not comparison.
Use this:
if ((sample < sinewave_length) && (PressStatus == 1)) {
Pete