updated to work with wiring-pi rather than the gpio library