Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

T-Mobile 12:58 PM K Pre lab 2 and Freedom Assig.... Detail Submission Grade Free

ID: 3589911 • Letter: T

Question

T-Mobile 12:58 PM K Pre lab 2 and Freedom Assig.... Detail Submission Grade Freedom Board Assignment 2 problem statement Write a code to create a 10 second timer using either timer library or timeout library or create your own timer using loops and reflect the output of the created timer by controlling (blink or turn on) the R,G and B LEDs of FRDM KL25Z sequentially for every 10 seconds. Reference code 1 and code 2 for FRDM - KL25Z related to assignment 2. (please do not use "wait" to create a 10 second period). 7 Courses Calendar To DoNotifications Messages

Explanation / Answer


int main(void) {
  /* Init board hardware. */
  BOARD_InitPins();
  BOARD_BootClockRUN();
  BOARD_InitDebugConsole();
  for(;;) {
    GPIO_ClearPinsOutput(GPIOA, 1<<13u); /* blue led on */
    delay(1000000);
    GPIO_SetPinsOutput(GPIOA, 1<<13u); /* blue led off */
    delay(1000000);

    GPIO_ClearPinsOutput(GPIOB, 1<<18u); /* red led on */
    delay(1000000);
    GPIO_SetPinsOutput(GPIOB, 1<<18u); /* red led off */
    delay(1000000);

    GPIO_ClearPinsOutput(GPIOB, 1<<19u); /* green led on */
    delay(1000000);
    GPIO_SetPinsOutput(GPIOB, 1<<19u); /* green led off */
    delay(1000000);
  }
  for(;;) { /* Infinite loop to avoid leaving the main function */
    __asm("NOP"); /* something to use as a breakpoint stop while looping */
  }
}