Alternates a device from on and off through an infinite loop every second