1) LED Blinking
1) LED Blinking
AIM:-
To understand the instruction set and the architecture of the mbed
board. Also to write a basic program to blink the on board LED present in the
board.
Board view:-
Features offered:-
The micro-controller used in this board is a low power AMR cortex M0
core.
Its clock speed is 48 MHz, with 8 KB RAM and 32 KB flash.
It will be used as a USB Device with 2 SPIs, I2C, UART, 6 ADCs, and GPIO.
The micro-controller is a 40 pin IC.
It can operate on 5V USB, 4.5 5V power supply or 2.4 3.3V battery.
Getting started with mbed:-
Connect the mbed board to the PC, after sometime the mbed board
will be recognized as a USB device.
Open the device and click on the mbed.htm file.
It will take us to the mbed account where we must log in or sign up.
We need a live internet connection for writing a program in mbed
board.
Uploading a code:-
Write the code in C on the mbed online complier.
Save and compile the code for verifying that the code is error free.
Download the code as a .bin format.
Open the mbed board device and just paste the code inside.
Then press the reset button.
When we press the reset the status led will blink once indicating the new
code is burnt.
If the status led is not doing so then try pasting the file again.
LED 1-4:-
We can get the full schematics for the board from mbed website.
Procedure:-
Login to the online IDE and sign up for an account.
Add the board (LPC11U23) to the workspace.
Connect the board using the USB cable and check the connection.
Type the code in the editor and compile it.
Copy the .bin file and paste it into the file directory of the board.
Click the reset button and the code will now run on the board.
Code:-
a) Single LED blink:
#include "mbed.h"
DigitalOut myled1(LED1);
int main() {
while(1) {
myled1 = 1;
wait(0.2);
myled1 = 0;
wait(0.2);
}
}
Output:-
Output:-
Result:-
Thus we have learnt how to use the mbed board and its online complier.
We also used its online complier to write a code to blink an onboard led.