just like you do with Serial print(variable,HEX) - this will print a hexidecimal number, from 0000 up to FFFF print(variable,DEC) or print(variable) - this will print a decimal integer, from 0000 up to 9999 If you need more control, you can call writeDigitNum(location, number) - this will write the number (0-9) to a single location. Location #0 is all the way to the left, location #2 is the colon dots so you probably want to skip it, location #4 is all the way to the right. If you want a decimal point, call writeDigitNum(location, number, true) which will paint the decimal point. To draw the colon, usedrawColon(true or false) If you wnat even more control, you can call writeDigitRaw(location,bitmask) to draw a raw 8-bit mask (as stored in a uint8_t) to that location. All the drawing routines only change the display memory kept by the Arduino. Don't forget to call writeDisplay() after drawing to 'save' the memory out to the matrix via I2C. There are also a few small routines that are special to the backpack: setBrightness(brightness)- will let you change the overall brightness of the entire display. 0 is least bright, 15 is brightest and is what is initialized by the display when you start blinkRate(rate) - You can blink the entire display. 0 is no blinking. 1, 2 or 3 is for display blinking.
// Bit mask codes. These can be used with writeDigitRaw to
// print various letters and symbols in a digit on the // seven segment LED display. // The first argument is the position // on the 4-digit display, starting at 0 (far left), // ending at 4 (far right), with position 2 being // the colon (so you'll skip this position usually). // The second argument is an integer that corresponds // to the binary representation of the combination of // 7 segments making up each digit. // 0 // ------ // 5 | | 1 // | 6 | // ------ // 4 | | 2 // | | // ------ o7 // 3 // For example, to make upper case A, you want to // light up segments 0,1,2,4,5,6. // The binary representation would be b01110111. // The bit positions are -->b76543210 // The corresponding integer value is 119 for A. // Use a binary-to-decimal calculator to convert. // Below is a list of codes for letters and symbols // sevenseg.writeDigitRaw(0,119); // 119 = "A" // sevenseg.writeDigitRaw(0,124); // 124 = "b" // sevenseg.writeDigitRaw(0,57); // 57 = "C" // sevenseg.writeDigitRaw(0,94); // 94 = "d" // sevenseg.writeDigitRaw(0,121); // 121 = "E" // sevenseg.writeDigitRaw(0,113); // 113 = "F" // sevenseg.writeDigitRaw(0,125); // 125 = "G" // sevenseg.writeDigitRaw(0,118); // 118 = "H" // sevenseg.writeDigitRaw(0,116); // 116 = "h" // sevenseg.writeDigitRaw(0,6); // 6 = "I" aka 1 // sevenseg.writeDigitRaw(0,4); // 4 = "i" // sevenseg.writeDigitRaw(0,30); // 30 = "J" // sevenseg.writeDigitRaw(0,56); // 56 = "L" // sevenseg.writeDigitRaw(0,84); // 84 = "n" // sevenseg.writeDigitRaw(0,92); // 92 = "o" // sevenseg.writeDigitRaw(0,115); // 115 = "P" // sevenseg.writeDigitRaw(0,103); // 103 = "q" aka 9 // sevenseg.writeDigitRaw(0,80); // 80 = "r" // sevenseg.writeDigitRaw(0,109); // 109 = "S" aka 5 // sevenseg.writeDigitRaw(0,70); // 70 = "t" // sevenseg.writeDigitRaw(0,28); // 28 = "u" // sevenseg.writeDigitRaw(0,62); // 62 = "U" // sevenseg.writeDigitRaw(0,110); // 110 = "y" // sevenseg.writeDigitRaw(0,64); // 64 = "-" negative sign // sevenseg.writeDigitRaw(0,34); // 34 = " " " double quote // sevenseg.writeDigitRaw(0,32); // 32 = "'" apostrophe (upper left) // sevenseg.writeDigitRaw(0,2); // 2 = "'" apostrophe (upper right) // sevenseg.writeDigitRaw(0,8); // 8 = "_" underscore // sevenseg.writeDigitRaw(0,1); // 1 = "-" overbar // sevenseg.writeDigitRaw(0,16); // 16 = lower left bar // sevenseg.writeDigitRaw(0,4); // 4 = lower right bar // sevenseg.writeDigitRaw(0,128); // 128 = "." decimal // sevenseg.writeDigitRaw(0,0); // blank // sevenseg.writeDigitRaw(2,255); // 255 = ":" colon, always position 2 /* ********************* Always follow a writeDigitRaw command with the writeDisplay(); command to push the data to the display. ************************ */ // sevenseg.writeDisplay(); // push data to display
// Example using writeDigitRaw to write numbers or characters
// to specific digits on the display. This spells 'run'. sevenseg.writeDigitRaw(0,80); // specify position and code, 80 = 'r' sevenseg.writeDigitRaw(1,28); // specify position and code, 28 = 'u' sevenseg.writeDigitRaw(3,84); // specify position and code, 84 = 'n' sevenseg.writeDisplay(); // push data to display delay(1000);