updated for mbed-os 5.5

Fork of Task121 by Nicholas Outram

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // Updated 2019 for Mbed-os 5.1X
00002 
00003 //This is known as a “header file”
00004 //In short, this copies and pastes the text file
00005 //mbed.h into this code
00006 #include "mbed.h"
00007 
00008 //Create a DigitalOut “object” called myled
00009 //Pass constant LED1 as a “parameter”
00010 DigitalOut myled(LED1);
00011 
00012 //The main function - all executable C / C++
00013 //applications have a main function. This is
00014 //out entry point in the software
00015 int main() {
00016     //Write a welcome message to the terminal
00017     puts("Welcome to the University of Plymouth");
00018 
00019     // ALL the repearing code is contained in a 
00020     // “while loop”
00021     while(1) 
00022     {
00023     //The code between the { curly braces }
00024     //is the code that is repeated  
00025         myled = 1; // External LED is ON
00026         wait_us(1000000); // 1 second
00027         myled = 0; // LED is OFF
00028         wait_us(1000000); // External 1 second
00029     }
00030 }
00031 
00032 
00033