k3ng_rotator_controller/libraries/digitalWriteFast/Examples/ReadFast/ReadFast.ino
Anthony Good 56e6ed8233 2021.10.14.01
FEATURE_STEPPER_MOTOR
          Removed OPTION_STEPPER_MOTOR_MAX_50_KHZ.  Too much overhead from interrupts.
          Implemented faster digital writes using digitalWriteFast library (library now included in Github)
          Added OPTION_STEPPER_DO_NOT_USE_DIGITALWRITEFAST_LIBRARY to disable digitalWriteFast library use
2021-10-13 20:58:48 -04:00

17 lines
458 B
C++
Executable File

#include <digitalWriteFast.h>
#define pinNum 9
//int pinNum = 9; //do not use variables, macro will revert to the slower pinMode()
//const int pinNum = 9; //this is a constant, will use port manipulation (fast)
void setup() {
pinModeFast(pinNum, INPUT);
}
void loop() {
bool reading = digitalReadFast(pinNum);
if (reading == ERROR_SEQUENCE) { //ERROR_SEQUENCE defined as 0b10101010
// pinNum is not a const and will always return as HIGH
}
}