Arduino Pin Library  v4.2.0
An easy to use Arduino library for fast and simultaneous operations on Arduino I/O pins.
Pin-Array.ino
Go to the documentation of this file.
1 
8 #include <Pin.h> // Include Pin Library
9 
10 Pin myPins[] = {2,3,4,5,6,7,8,9}; // Create array of Pin objects for digital pins labelled 2-9 on any of the supported boards
11 int myPinsSize = sizeof(myPins) / sizeof(Pin); // Store the length of the array of Pins
12 
16 void setup() {
17  for (int i = 0; i < myPinsSize; i++) { // Iterate over array of Pins
18  myPins[i].setOutput(); // Set Pin to output
19  }
20 }
21 
25 void loop() {
26  for (int i = 0; i < myPinsSize; i++) { // Iterate over array of Pins
27  myPins[i].setLow(); // Set Pin to low
28  }
29 
30  delay(200); // Wait 200 milliseconds
31 
32  for (int i = 0; i < myPinsSize; i++) { // Iterate over array of Pins
33  myPins[i].setHigh(); // Set Pin to high
34  }
35 
36  delay(200); // Wait 200 milliseconds
37 
38 }
void setHigh()
Set the pin output to HIGH.
Definition: Pin.h:365
Class for fast operations on Arduino I/O pins.
Definition: Pin.h:39
void setOutput()
Set the pin mode to output.
Definition: Pin.h:355
Fast operations on Arduino I/O pins.
void loop()
Called continously after setup.
Definition: Pin-Array.ino:25
int myPinsSize
Definition: Pin-Array.ino:11
void setLow()
Set the pin output to LOW.
Definition: Pin.h:375
void setup()
Called at start.
Definition: Pin-Array.ino:16
Pin myPins[]
Definition: Pin-Array.ino:10