View Index by Level
RANDOM PAGE

SITE SEARCH

LOG
IN

SIGN UP

HELP

mbed Hello World


This is the AQA version closing after June 2019. Visit the the version for Eduqas instead.

To gain access to revision questions, please sign up and log in.

Non-Exam Extras

Four LEDs are built into the mbed board. This program flashes them on for 0.2 seconds and off for 0.2 seconds, repeating for ever.

#include "mbed.h"

// CONFIGURE FOUR OUTPUT LINES (FOR THE BUILT-IN LEDs)
DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
DigitalOut myled3(LED3);
DigitalOut myled4(LED4);

int main() {
    while(1) {             // REPEAT FOR EVER
        myled1 = 1;        // LED ON
        myled2 = 0;        // LED OFF
        myled3 = 1;
        myled4 = 0;
        wait(0.2);         // 0.2 SECOND DELAY
        myled1 = 0;
        myled2 = 1;
        myled3 = 0;
        myled4 = 1;
        wait(0.2);         // 0.2 SECOND DELAY
    }
}

 

 

 

reviseOmatic V3     Contacts, ©, Cookies, Data Protection and Disclaimers Hosted at linode.com, London