added controlling an gpio pin when result reaches a certain threshold