FIX: incorrect reading of the gpio pin within the loop