programming a pir sensor using arduino

basically you want to make a variable m use a variable r to read pir output when detected increment variable m by 1 and then testing var m to be equal to 3 activate servo