Prevented flickering of LED on GPIO4 by checking the state before changing it.