api / mbed / trunk / AnalogIn
AnalogIn
class AnalogIn : public Base
An analog input, used for reading the voltage on a pin
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());
}
}
}| AnalogIn | An analog input, used for reading the voltage on a pin |
| Functions | |
| AnalogIn | Create an AnalogIn, connected to the specified pin |
| read | Read the input voltage, represented as a float in the range [0.0, 1.0] |
| read_u16 | Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF] |
| operator float | An operator shorthand for read() |
An analog input, used for reading the voltage on a pin
class AnalogIn : public Base
Create an AnalogIn, connected to the specified pin
AnalogIn( PinName pin, const char * name = NULL )
Read the input voltage, represented as a float in the range [0.0, 1.0]
float read()
Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
unsigned short read_u16()
An operator shorthand for read()
operator float()
