Question
Using Code Composer Studio with board EK-TM4C123GXL write a code implementing the following: - In addition to main(), you will create two new functions: blink()
Using Code Composer Studio with board EK-TM4C123GXL write a code implementing the following:
- In addition to main(), you will create two new functions: blink() and delay().
- Use main() to set up the clock rate and enable GPIO port associated red and blue LEDs.
- Use blink() that takes three arguments: the first specifies the color, the blink rate, and the last is how many times to blink the color.
- Use delay() to write a do-nothing loop that simply consumes time.
in order to do the following:
blink the blue LED five times (1s on, 1s off) for a total of 10s, (b) blink the red LED ten times (0.5s on, 0.5s off), repeat (a)-(b) until the power is removed.
Here is an example:
#include
#ifdef DEBUG void __error__(char *pcFilename, uint32_t ui32Line) { while(1); } #endif
int main(void) { volatile uint32_t ui32Loop;
// // Enable the GPIO port that is used for the on-board LED. // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
// // Check if the peripheral access is enabled. // while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOF)) { }
// // Enable the GPIO pin for the LED (PF3). Set the direction as output, and // enable the GPIO pin for digital function. // GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3);
// // Loop forever. // while(1) { // // Turn on the LED. // GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, GPIO_PIN_3);
// // Delay for a bit. // for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++) { }
// // Turn off the LED. // GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, 0x0);
// // Delay for a bit. // for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++) { } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started