DigitalToggle Library for Arduino Author: David Knaack Contact: firstname.lastname@example.org
0.1 2009-07-6: Initial Release
DigitalToggle is a library for the Arduino.
It provides the functions digitalToggle() and digitalToggleFast() which toggle the state of the specified digital pin by looking up the appropriate AVR PIN register for the digital pin and then writing the appropriate bit in that register, causing the corresponding PORT bit to be toggled.
This is useful when it is desirable to change the state of a pin, regardless of the current state.
Download here: Attach:DigitalToggle.zip
Put the DigitalToggle folder in "hardware\libraries\".
In the Arduino IDE, create a new sketch (or open one) and select from the menubar "Sketch->Import Library->DigitalToggle".
No setup is required, simply call the function.
Toggle the state of the specified digital pin. Note that digitalToggle does not check whether the pin has been set up as an output or if it is being used as a PWM output.
The first use of digitalToggle() adds about 58 bytes to the compiled code, subsequent calls add about 8 bytes each.
Toggle the state of the specified digital pin. This differs from digitalToggle() in that it is declared with a #define in order to eliminate the overhead of one function call, providing about a 20% reduction in the time needed to toggle the pin at the cost of code size.
Each call to digitalToggleFast() adds 44 bytes to the compiled code.
|Last Modified:||November 03, 2012, at 05:26 PM|