Nicholas Outram / Mbed OS Task121
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 //This is known as a “header file”
00002 //In short, this copies and pastes the text file
00003 //mbed.h into this code
00004 #include "mbed.h"
00005 
00006 //Create a DigitalOut “object” called myled
00007 //Pass constant D7 as a “parameter”
00008 DigitalOut myled(D7);
00009 
00010 //The main function - all executable C / C++
00011 //applications have a main function. This is
00012 //out entry point in the software
00013 int main() {
00014 
00015 // ALL the code is contained in a 
00016 // “while loop”
00017     while(1) 
00018     {
00019     //The code between the { curly braces }
00020     //is the code that is repeated  
00021         myled = 1; // External LED is ON
00022         wait(1.0); // 1 second
00023         myled = 0; // LED is OFF
00024         wait(1.0); // External 1 second
00025     }
00026 }
00027 
00028 //updated for mbed os 5.4
00029