Working code; the other pins are used for ground