BusInOut Hello World

Fork of BusInOut_HelloWorld by Mbed

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

No documentation found.
Committer:
sarahmarshy
Date:
Mon Jun 26 08:55:20 2017 -0500
Revision:
4:910f6ba3c4a3
Parent:
3:68629c6c4970
"Update mbed-os"

Who changed what in which revision?

UserRevisionLine numberNew 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
mab5449 3:68629c6c4970 19 BusInOut pins(D0, D1, D2);
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 }