You are viewing an older revision! See the latest version

BusOut

/media/uploads/mbedofficial/digitalout_interfaces.png

The BusOut interface is used to create a number of DigitalOut pins that can be written as one value.

Hello World!

Binary counter on LEDs

#include "mbed.h"

BusOut myleds(LED1, LED2, LED3, LED4);

int main() {
    while(1) {
        for(int i=0; i<16; i++) {
            myleds = i;
            wait(0.25);
        }
    }
}

API

API summary

[error loading api]

Interface

The BusOut interface can be used on mbed pins p5-p30, and also on-board LED1-LED4

The BusOut interface can be used to set the state of the output pins, and also read back the current output state.

Examples

Scroll across the LEDs

#include "mbed.h"

BusOut myleds(LED1, LED2, LED3, LED4);

int main() {
    while(1) {
        for(int i=0; i<4; i++) {
            myleds = 1 << i;
            wait(0.25);
        }
    }
}

All wikipages