Handling inputs and outputs
Inputs and outputs on development boards are either analog or digital.
These APIs read or set the voltage of analog pins:
- AnalogIn: read the voltage of an analog input pin.
- AnalogOut: set the voltage of an analog output pin.
You can control the digital pins individually or as a grouped value.
- DigitalIn: read a single digital input pin.
- DigitalOut: write to a single digital output pin.
- DigitalInOut: read and write to a single bidirectional digital pin.
- Bus: flexible control of multiple pins:
- Port: fast way to handle an underlying GPIO; this is less flexible than the bus because of the constraints the underlying GPIO ports impose:
InterruptIn triggers an event when a digital input pin changes value.
PwmOut controls the frequency and mark to space ratio of a digital pulse wave (or train).