You are viewing an older revision! See the latest version

BusIn

Table of Contents

  1. Hello World!
  2. API
  3. Related

/media/uploads/mbedofficial/digitalin_interfaces.png

The BusIn interface is used to create a number of DigitalIn pins that can be read as one value.

Any of the numbered mbed pins can be used as a DigitalIn in the BusIn.

Hello World!

Control all the LEDs as a single value

#include "mbed.h"

BusIn nibble(p5, p6, p18, p11);

int main() {
    while(1) {
        switch(nibble) {
            case 0x3: printf("Hello!\n"); break; // p5 and p6 are 1
            case 0x8: printf("World!\n"); break; // p11 is 1
        }
    }
}

API


All wikipages