working solution with pi-gpio