In this tutorial we will see how to blink the LED using the explore Embedded bare metal libraries.
Contents
[hide]References
Please check the below link for detailed explanation on LPC1768 GPIO's configuration.
LPC1768 GPIO Configuration
Project Setup
Check the below links to setup the project for generating the .bin file.
Hardware Connection
Similar to arduino the LED is connected to pin number 13.
Code
Below is the sample code the blink the LED connected at pin 13.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "delay.h" | |
#include "gpio.h" | |
#include "stdutils.h" | |
#define LED 13 //LED is connected to pin 13 on Explore M3 board | |
int main() | |
{ | |
SystemInit(); //Clock and PLL configuration | |
GPIO_PinFunction(LED,PINFUN_GPIO); // Configure Pin for Gpio | |
GPIO_PinDirection(LED,OUTPUT); // Configure the pin as OUTPUT | |
while(1) | |
{ | |
GPIO_PinWrite(LED,HIGH); // Turn ON the Led | |
DELAY_ms(100); // Wait for some time | |
GPIO_PinWrite(LED,LOW); // Turn OFF the Led | |
DELAY_ms(100); // Wait for some time | |
} | |
} |