Modify main.c
Step 9 - Add the following code to the end of the main.c file:
void main(void)
{
// initialize the device
SYSTEM_Initialize();
while (1)
{
__delay_ms(250);
LED_D2_Toggle();
}
}
__delay_ms(250) is a delay function built into the XC8 compiler
The LED_D2_Toggle() is a macro generated by the MCC and its definition is located in the pin_manager.h file.
#define LED_D2_Toggle() do { LATAbits.LATA4 = ~LATAbits.LATA4; } while(0)
This is a simple example of how the MCC generates a library of useful macros to make creating project code much easier and quicker.