![](/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@2:d6010b360bca, 2015-03-27 (annotated)
- Committer:
- mbedAustin
- Date:
- Fri Mar 27 20:12:44 2015 +0000
- Revision:
- 2:d6010b360bca
- Parent:
- 1:075e57eccf3a
- Child:
- 3:68629c6c4970
Added license to main.c file.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedAustin | 2:d6010b360bca | 1 | /* mbed Example Program |
mbedAustin | 2:d6010b360bca | 2 | * Copyright (c) 2006-2014 ARM Limited |
mbedAustin | 2:d6010b360bca | 3 | * |
mbedAustin | 2:d6010b360bca | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
mbedAustin | 2:d6010b360bca | 5 | * you may not use this file except in compliance with the License. |
mbedAustin | 2:d6010b360bca | 6 | * You may obtain a copy of the License at |
mbedAustin | 2:d6010b360bca | 7 | * |
mbedAustin | 2:d6010b360bca | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
mbedAustin | 2:d6010b360bca | 9 | * |
mbedAustin | 2:d6010b360bca | 10 | * Unless required by applicable law or agreed to in writing, software |
mbedAustin | 2:d6010b360bca | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
mbedAustin | 2:d6010b360bca | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbedAustin | 2:d6010b360bca | 13 | * See the License for the specific language governing permissions and |
mbedAustin | 2:d6010b360bca | 14 | * limitations under the License. |
mbedAustin | 2:d6010b360bca | 15 | */ |
mbedAustin | 2:d6010b360bca | 16 | |
stevep | 1:075e57eccf3a | 17 | #include "mbed.h" |
stevep | 1:075e57eccf3a | 18 | |
stevep | 1:075e57eccf3a | 19 | BusInOut pins(p5, p10, p7); |
stevep | 1:075e57eccf3a | 20 | |
stevep | 1:075e57eccf3a | 21 | int main() { |
stevep | 1:075e57eccf3a | 22 | while(1) { |
stevep | 1:075e57eccf3a | 23 | pins.output(); |
stevep | 1:075e57eccf3a | 24 | pins = 0x3; |
stevep | 1:075e57eccf3a | 25 | wait(1); |
stevep | 1:075e57eccf3a | 26 | pins.input(); |
stevep | 1:075e57eccf3a | 27 | wait(1); |
stevep | 1:075e57eccf3a | 28 | if(pins == 0x6) { |
stevep | 1:075e57eccf3a | 29 | printf("Hello!\n"); |
stevep | 1:075e57eccf3a | 30 | } |
stevep | 1:075e57eccf3a | 31 | } |
mbed_official | 0:91a6f3d1b2f0 | 32 | } |