working code with different pins