Arduino Pin Library v4.2.2
An easy to use Arduino library for fast and simultaneous operations on Arduino I/O pins.
Loading...
Searching...
No Matches
Pin-Array.ino
#include <Pin.h> // Include Pin Library
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
int myPinsSize = sizeof(myPins) / sizeof(Pin); // Store the length of the array of Pins
void setup() {
for (int i = 0; i < myPinsSize; i++) { // Iterate over array of Pins
myPins[i].setOutput(); // Set Pin to output
}
}
void loop() {
for (int i = 0; i < myPinsSize; i++) { // Iterate over array of Pins
myPins[i].setLow(); // Set Pin to low
}
delay(200); // Wait 200 milliseconds
for (int i = 0; i < myPinsSize; i++) { // Iterate over array of Pins
myPins[i].setHigh(); // Set Pin to high
}
delay(200); // Wait 200 milliseconds
}
Fast operations on Arduino I/O pins.
Class for fast operations on Arduino I/O pins.
Definition Pin.h:40
void setHigh()
Set the pin output to HIGH.
Definition Pin.h:349
void setOutput()
Set the pin mode to output.
Definition Pin.h:339
void setLow()
Set the pin output to LOW.
Definition Pin.h:359