Recent changes
Order
tag order
RTOS
Help
mbed NXP LPC1768
Firmware
Homepage
From the mbed microcontroller Handbook.  

DigitalInOut

/media/uploads/mbedofficial/digitalin_interfaces.png

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!

Reset a 1-Wire device

 
#include "mbed.h"

DigitalInOut pin(p5);

int main() {
    pin.output();
    pin = 0;     
    wait_us(500);
    pin.input();
    wait_us(500);
}

API

API summary

DigitalInOutA digital input/output, used for setting or reading a bi-directional pin
Functions
DigitalInOutCreate a DigitalInOut connected to the specified pin
writeSet the output, specified as 0 or 1 (int)
readReturn the output setting, represented as 0 or 1 (int)
outputSet as an output
inputSet as an input
modeSet the input pin mode
operator=A shorthand for write
operator int()A shorthand for read
class DigitalInOut : public Base
A digital input/output, used for setting or reading a bi-directional pin
DigitalInOut(PinName pin,  
const char *name =  NULL)
Create a DigitalInOut connected to the specified pin
void write(int value)
Set the output, specified as 0 or 1 (int)
int read()
Return the output setting, represented as 0 or 1 (int)
void output()
Set as an output
void input()
Set as an input
void mode(PinMode pull)
Set the input pin mode
DigitalInOut& operator= (int value)
A shorthand for write
operator int()
A shorthand for read

Related




calendar Page history
Last modified 21 Jul 2010, by   user Dan Ros   tag No tags | 0 comments  

Please login to post comments.