![](/media/cache/group/mbed-logo-square-512_3.png.50x50_q85.png)
BusInOut Hello World
Fork of BusInOut_HelloWorld by
Use
The BusInOut interface is used to create an artificial bus of pins and read from / write to them. Pay special attention to the ordering of the pins in the initialization.
API
API reference.
Import librarymbed
main.cpp@0:91a6f3d1b2f0, 2013-02-12 (annotated)
- Committer:
- mbed_official
- Date:
- Tue Feb 12 11:26:02 2013 +0000
- Revision:
- 0:91a6f3d1b2f0
- Child:
- 1:075e57eccf3a
BusInOut HelloWorld
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:91a6f3d1b2f0 | 1 | #include "mbed.h" |
mbed_official | 0:91a6f3d1b2f0 | 2 | |
mbed_official | 0:91a6f3d1b2f0 | 3 | BusInOut pins(p5, p10, p7); |
mbed_official | 0:91a6f3d1b2f0 | 4 | |
mbed_official | 0:91a6f3d1b2f0 | 5 | int main() { |
mbed_official | 0:91a6f3d1b2f0 | 6 | pins.output(); |
mbed_official | 0:91a6f3d1b2f0 | 7 | pins = 0x3; |
mbed_official | 0:91a6f3d1b2f0 | 8 | wait(1); |
mbed_official | 0:91a6f3d1b2f0 | 9 | pins.input(); |
mbed_official | 0:91a6f3d1b2f0 | 10 | wait(1); |
mbed_official | 0:91a6f3d1b2f0 | 11 | if(pins == 0x6) { |
mbed_official | 0:91a6f3d1b2f0 | 12 | printf("Hello!\n"); |
mbed_official | 0:91a6f3d1b2f0 | 13 | } |
mbed_official | 0:91a6f3d1b2f0 | 14 | } |