
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.
#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 summary
| BusIn | A digital input bus, used for reading the state of a collection of pins |
| Configuration Methods | |
| BusIn | Create an BusIn, connected to the specified pins |
| Access Methods | |
| read | Read the value of the input bus |
| Access Method Shorthand | |
| operator int() | A shorthand for read |
A digital input bus, used for reading the state of a collection of pins
class BusIn : public Base
Create an BusIn, connected to the specified pins
BusIn( PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC, PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC, PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC, PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC, const char * name = NULL )
Read the value of the input bus
int read()
A shorthand for read
operator int()
Please login to post comments.