
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.
#include "mbed.h"
DigitalInOut pin(p5);
int main() {
pin.output();
pin = 0;
wait_us(500);
pin.input();
wait_us(500);
}
API summary
| DigitalInOut | A digital input/output, used for setting or reading a bi-directional pin |
| Functions | |
| DigitalInOut | Create a DigitalInOut connected to the specified pin |
| write | Set the output, specified as 0 or 1 (int) |
| read | Return the output setting, represented as 0 or 1 (int) |
| output | Set as an output |
| input | Set as an input |
| mode | Set the input pin mode |
| operator= | A shorthand for write |
| operator int() | A shorthand for read |
A digital input/output, used for setting or reading a bi-directional pin
class DigitalInOut : public Base
Create a DigitalInOut connected to the specified pin
DigitalInOut( PinName pin, const char * name = NULL )
Set the output, specified as 0 or 1 (int)
void write( int value )
Return the output setting, represented as 0 or 1 (int)
int read()
Set as an output
void output()
Set as an input
void input()
Set the input pin mode
void mode( PinMode pull )
A shorthand for write
DigitalInOut& operator= ( int value )
A shorthand for read
operator int()
No tags
|
0 comments
Please login to post comments.