UDN2981A Channel Source Drivers

Used Products:

1. Arduino UNO
2. UDN2981A

Code:

int pins[] = {2,3,4,5,6,7,8,9}; int count = 0; int v = 1; void setup() { for (int i = 0; i < 8; i++) { pinMode(pins[i], OUTPUT); } } void loop() { for (int i = 0; i < 8; i++) { digitalWrite(pins[i], i==count); } delay(100); if (count == 7) { v = -1; } else if (count == 0) { v = 1; } count = count + v; }