This function loads a integer and displays it as a decimal number on the display. It can display on parts of the display at specified location so that different quantities can be displayed with proper alignment and space for showing units etc. For example, displaying the hours and minutes in a clock or timer display.
showValue(unsigned short value, int pos, byte digits, byte align)
value: value to be displayed.
pos: position where the number is to be displayed
digits: number of digits to be used, maximum 4. If the number does not fit within the number of digits specified, least significant digits are displayed.
align: alignment of the digits, right or left aligned
(:source:)
Multiplex7SegSW sevenseg1; unsigned int minutes; int hours;
void setup() {
sevenseg1.set(1, noOfDigits, digitPins, segmentPins); minutes = 0;
}
void loop() {
hours = (minutes / 60) % 24; // For a 24-hr clock sevenseg1.showValue(hours, 0, 2, ALIGN_RIGHT); sevenseg1.showValue(minutes % 60, 2, 2, ALIGN_RIGHT);
}
(:sourceend:)
This text is from the Papilio reference and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.