It's nothing more than digital Io and analog Io
Digital Io
- Digitalout-configure and control a digital output pin.
- Digitalin-configure and control a digital input pin.
- Digitalinout-bi-directional digital pins
Each page on the mbed website has a hardware diagram to show you the pin name. The blue labels can be used as digital Io.
If digitalout is used, 0 is off, and 1 is on;
In digitalin, input lower than 0.8v is considered as 0, input higher than 2.0v is considered as 1.
Digitalinout is the sum of the two above.
- Busin-flexible way to read multiple digitalin pins as one value
- Busout-flexible way to write multiple digitalout pins as one value
- Businout-flexible way to read/write multiple digitalinout pins as one value
Bus is a very interesting thing.
Using bus, you can read a string of digital Io ports at the same time, and their statuses are saved as a binary number. For more information, see the above link.
- Portin-fast way to read multiple digitalin pins as one value
- Portout-fast way to write multiple digitalout pins as one value
- Portinout-fast way to read/write multiple digitalinout pins as one value
Port is to read the data of gpio in the same port at the same time. Faster than bus. For more information, see the above link.
The port name is in portnames. h.
- Pwmout-pulse-width modulated output
PWM output, very useful.
First, check whether the interface supports PWM output in the hardware diagram. Second, different pin may be connected to a timer. If they all use the PWM mode, their output will be the same.
You can set the period, pulse width, and duty cycle of PWM. For more information, see the above link.
Analog Io
You can specify the analog Io pin on the hardware diagram.
The read and output ranges from 0.0 ~ 3.3 V.
The common read () reads 0.0 ~ 1.0. Read from 0x0 ~ 0xffff.
Mbed platform I/O