![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
The program uses the BusInout Class to make a key_controlled counter from 0-9
Dependencies: mbed
Fork of BusInOut_HelloWorld by
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:e9a810015812
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 | } |