DigitalInOut

Mbed OS 2 and Mbed OS 5

This is the handbook for Mbed OS 2. If you’re working with Mbed OS 5, please see the new handbook. For the latest DigitalInOut API, please see DigitalInOut.

The DigitalInOut interface is used as a bi-directional digital pin, used to read the value of a digital pin when set as an input, or write the value when set as an output.

Any of the numbered mbed pins can be used as a DigitalInOut.

Hello World!

Import program

00001 #include "mbed.h"
00002  
00003 DigitalInOut pin(p5);
00004  
00005 int main() {
00006     pin.output();
00007     pin = 0;     
00008     wait_us(500);
00009     pin.input();
00010     wait_us(500);
00011 }

[Not found]

API

API summary

[Not found]

Interface

The DigitalInOut Interface can be used on any pin with a blue label.

/media/uploads/chris/pinout-thumbnails.jpg
See the Pinout page for more details