Arduino Pin Library  v4.2.0
An easy to use Arduino library for fast and simultaneous operations on Arduino I/O pins.
Pin-Timer.ino
Go to the documentation of this file.
1 
8 #include <Pin.h> // Include Pin Library
9 
10 Pin myPin = Pin(13); // Create Pin object for digital pin labelled 13 on any of the supported boards
11 
15 void setup() {
16  Serial.begin(9600); // Start serial communication at 9600 baud
17  myPin.setLow(); // Set Pin state to LOW to disable the pullup resistor and make sure the pin is driven to low at the end of the the rcTimer function, THIS IS VERY IMPORTANT
18 }
19 
23 void loop() {
24  delay(500); // Wait 500 milliseconds
25 
26  // If a force sensitve resistor is used with a capacitor, the more force applied to the fsr (lower resistance), the faster the capactor will charge resulting in a number closer to the inital value
27  Serial.println(String(myPin.rcTimer(255))); // Print the value remaining on the timer when the pin went HIGH
28 }
Class for fast operations on Arduino I/O pins.
Definition: Pin.h:39
void loop()
Called continously after setup.
Definition: Pin-Timer.ino:23
Pin myPin
Definition: Pin-Timer.ino:10
Fast operations on Arduino I/O pins.
void setLow()
Set the pin output to LOW.
Definition: Pin.h:375
void setup()
Called at start.
Definition: Pin-Timer.ino:15
volatile unsigned int rcTimer(volatile unsigned int count)
Set the pin mode to input and decrement a counter until the pin goes HIGH or the counter reaches 0 th...
Definition: Pin.h:448