ULN2803APG Darlington Driver 8-Channel

Used Products:

1. Arduino UNO
2. ULN2003APG
3. ULN2803APG

Code:

int pins[] = {2,3,4,5,6,7,8,9}; #define commonPin 10 const int ARRAY_SIZE = sizeof(pins) / sizeof(int); int count = 0; void setup() { for (int i = 0; i < ARRAY_SIZE; i++) { pinMode(pins[i], OUTPUT); } pinMode(commonPin, OUTPUT); for (int i = 0; i < ARRAY_SIZE; i++) { digitalWrite(pins[i], LOW); } digitalWrite(commonPin, HIGH); } void loop() { for (int i = 0; i < ARRAY_SIZE; i++) { digitalWrite(pins[i], count==i); } digitalWrite(commonPin, HIGH); count = ++count%8; delay(100); if (count == 0) { digitalWrite(commonPin, LOW); delay(500); } }