statt:
if( pinx == (1 << px))
versuch mal
if( pinx & (1 << px))