// This program implements a random die on the E15 I/O board. // When you push the button on the board, the LED's go off and // a number is rapidly, and repeatedly, incremented from 1 to 6. // When the button is released the current value of that number // is displayed on the die face. // // Written by: (fill in your names) #include //******************************************************************* // This function, LED_Die(), takes an integer (val) as input. // If val=0, no LED's on the die face light. // If val=1, the center one lights. // If val=2, two diagonal corner LED's light. // If val=3, three diagonal LED's light. // If val=4, the four corner LED's light. // if val=5, the four corner and the center LED's light. // if val=6, the four corner and two side LED's light. void LED_Die(int val) { // &&&&&&&&&& Add your well commented and neatly indented code here } //********************************************************************* void main(void) { volatile int dieVal=1; WDTCTL = WDTPW + WDTHOLD; // Stop watchdog P1DIR = P1DIR | BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6; // P1.0-P1.6 are output //Note: we could also use : P1DIR |=0x7f; P2SEL = P2SEL & ~BIT6; //Clear select bit (makes P2.6 an input) while (1) { //Do this forever // &&&&&&&&&& Add your well commented and neatly indented code here. // When the button is pushed it should increment dieVal (but not above 6) // and it should call LED_Die to turn off the LED's. // When the button is released, it should display the current dieVal on // the LED's. } }