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 this program
#include "mbed.h" DigitalInOut pin(p5); int main() { pin.output(); pin = 0; wait_us(500); pin.input(); wait_us(500); }
» Import this program
#include "mbed.h" DigitalInOut pin(PTB0); int main() { pin.output(); pin = 0; wait_us(500); pin.input(); wait_us(500); }
API¶
API summary
» Import latest build into a program
Public Member Functions |
|
| DigitalInOut (PinName pin) | |
|
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()
|
|
Interface¶
The DigitalInOut Interface can be used on any pin with a blue label.
| See the Pinout page for more details |
Related¶
Last modified 02 Mar 2013, by .
1 reply
1 comment:
Posting comments for this page has been disabled



Please login to post comments.