![](/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@1:075e57eccf3a, 2013-02-12 (annotated)
- Committer:
- stevep
- Date:
- Tue Feb 12 11:59:55 2013 +0000
- Revision:
- 1:075e57eccf3a
- Parent:
- 0:91a6f3d1b2f0
- Child:
- 2:d6010b360bca
Put example in a loop
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
stevep | 1:075e57eccf3a | 1 | #include "mbed.h" |
stevep | 1:075e57eccf3a | 2 | |
stevep | 1:075e57eccf3a | 3 | BusInOut pins(p5, p10, p7); |
stevep | 1:075e57eccf3a | 4 | |
stevep | 1:075e57eccf3a | 5 | int main() { |
stevep | 1:075e57eccf3a | 6 | while(1) { |
stevep | 1:075e57eccf3a | 7 | pins.output(); |
stevep | 1:075e57eccf3a | 8 | pins = 0x3; |
stevep | 1:075e57eccf3a | 9 | wait(1); |
stevep | 1:075e57eccf3a | 10 | pins.input(); |
stevep | 1:075e57eccf3a | 11 | wait(1); |
stevep | 1:075e57eccf3a | 12 | if(pins == 0x6) { |
stevep | 1:075e57eccf3a | 13 | printf("Hello!\n"); |
stevep | 1:075e57eccf3a | 14 | } |
stevep | 1:075e57eccf3a | 15 | } |
mbed_official | 0:91a6f3d1b2f0 | 16 | } |