digitalWriteNibble()
[Digital I/O]
void digitalWriteNibble(unsigned short a, unsigned short b, unsigned short c, unsigned short d, unsigned char value);Description
Writes a 4-bit value (nibble) to the specified Custom Element pins.
If the pin has been configured as an output with
pinMode(), its voltage will be set to the corresponding
value, following the family electronic standards configured with
logicFamily().
If the pins are configured as an input, the function will have no effect.
Parameters
a: the pin of the most significant bit of the nibble
(MSB).
b: the pin of the second most significant bit of the
nibble.
c: the pin of the second least significant bit of the
nibble.
d: the pin of the least significant bit of the nibble
(LSB).
value: HIGH or LOW
Returns
Nothing.
Example Code
The code writes the value of a nibble to the Custom Element pins 3, 4, 5, and 6.
void setup() {
pinLabel(3, "OUT"); // sets the pin 3 label to "OUT"
pinMode(3, OUTPUT); // sets the digital pin 3 as output
pinLabel(4, "OUT"); // sets the pin 4 label to "OUT"
pinMode(4, OUTPUT); // sets the digital pin 4 as output
pinLabel(5, "OUT"); // sets the pin 5 label to "OUT"
pinMode(5, OUTPUT); // sets the digital pin 5 as output
pinLabel(6, "OUT"); // sets the pin 6 label to "OUT"
pinMode(6, OUTPUT); // sets the digital pin 6 as output
}
void loop() {
digitalWriteNibble(3, 4, 5, 6, 10); // writes the value 0b1010 to the pins 3, 4, 5, and 6
}Notes and Warnings
All the pins are set as inputs by default, so they must be configured
as outputs with pinMode() before using
digitalWriteNibble().
