Code snippet for LED

Answered by @MaKim.