k3ng_rotator_controller/libraries/digitalWriteFast/Examples/ToggleSlow/ToggleSlow.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

38 lines
1.1 KiB
C++
Executable File

#define pinNum 9
//int pinNum = 9; //for regular digitalWrite(), does matter constant or variable
//const int pinNum = 9; //this is a constant
void setup() {
pinMode(pinNum, OUTPUT);
}
void loop() {
//digitalWrite is so slow that , you don't actually need to toggle multiple times in 1 loop
// because digitalWrite takes 6280ns but to return to the start of loop takes only 600ns.
// this only makes a big deal when using digitalWriteFast(pinNum, state);
digitalWrite(pinNum, HIGH);
digitalWrite(pinNum, LOW);
digitalWrite(pinNum, HIGH);
digitalWrite(pinNum, LOW);
digitalWrite(pinNum, HIGH);
digitalWrite(pinNum, LOW);
digitalWrite(pinNum, HIGH);
digitalWrite(pinNum, LOW);
digitalWrite(pinNum, HIGH);
digitalWrite(pinNum, LOW);
digitalWrite(pinNum, HIGH);
digitalWrite(pinNum, LOW);
digitalWrite(pinNum, HIGH);
digitalWrite(pinNum, LOW);
digitalWrite(pinNum, HIGH);
digitalWrite(pinNum, LOW);
digitalWrite(pinNum, HIGH);
digitalWrite(pinNum, LOW);
digitalWrite(pinNum, HIGH);
digitalWrite(pinNum, LOW);
digitalWrite(pinNum, HIGH);
digitalWrite(pinNum, LOW);
digitalWrite(pinNum, HIGH);
digitalWrite(pinNum, LOW);
}