It is not obvious to me what you are trying to do. If your intent is to toggle either piPin1 or piPin2, depending on the state of the piState pin, as rapidly as possible then that code should do the job.
It is not obvious to me what you are trying to do. If your intent is to toggle either piPin1 or piPin2, depending on the state of the piState pin, as rapidly as possible then that code should do the job.