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-Timer.ino
#include <Pin.h> // Include Pin Library
Pin myPin = Pin(13); // Create Pin object for digital pin labelled 13 on any of the supported boards
void setup() {
Serial.begin(9600); // Start serial communication at 9600 baud
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
}
void loop() {
delay(500); // Wait 500 milliseconds
// 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
Serial.println(String(myPin.rcTimer(255))); // Print the value remaining on the timer when the pin went HIGH
}
Fast operations on Arduino I/O pins.
Class for fast operations on Arduino I/O pins.
Definition Pin.h:40
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:424
void setLow()
Set the pin output to LOW.
Definition Pin.h:359