Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MAX34417_demo MAXREFDES1265 MAXREFDES1265
Fork of mbed-dev by
AnalogIn Class Reference
[Drivers]
An analog input, used for reading the voltage on a pin. More...
#include <AnalogIn.h>
Public Member Functions | |
| AnalogIn (PinName pin) | |
| Create an AnalogIn, connected to the specified pin. | |
| float | read () |
| Read the input voltage, represented as a float in the range [0.0, 1.0]. | |
| unsigned short | read_u16 () |
| Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF]. | |
| operator float () | |
| An operator shorthand for read() | |
Detailed Description
An analog input, used for reading the voltage on a pin.
Synchronization level: Thread safe
Example:
// Print messages when the AnalogIn is greater than 50% #include "mbed.h" AnalogIn temperature(p20); int main() { while(1) { if(temperature > 0.5) { printf("Too hot! (%f)", temperature.read()); } } }
Definition at line 52 of file AnalogIn.h.
Constructor & Destructor Documentation
| AnalogIn | ( | PinName | pin ) |
Create an AnalogIn, connected to the specified pin.
- Parameters:
-
pin AnalogIn pin to connect to name (optional) A string to identify the object
Definition at line 61 of file AnalogIn.h.
Generated on Tue Jul 12 2022 20:41:24 by
1.7.2
