/* Program to display a counter counting from 0 to 3 on seven-segment display of * Wytec EduPad board with Tiva TM4C123/MSP432. * The seven-segment display is connected to an 8-bit shift registers on SPI. * The shift register is used to select the segments of the display. * The seven-segment display has common cathode. The segment select is high active. * * Energia 1.6.10E18 */ #include const int slaveSelect = 34; void setup() { // set the slaveSelectPin as an output: pinMode (slaveSelect, OUTPUT); // initialize SPI: SPI.begin(); } void loop() { const static unsigned char digitPattern[] = {0x3F, 0x06, 0x5B, 0x4F}; static int i; // assert SS low to the shift register of seven-segment LED digitalWrite(slaveSelect, LOW); // send the digit pattern SPI SPI.transfer(~digitPattern[i++ % 3]); // deassert SS digitalWrite(slaveSelect, HIGH); delay(1000); }