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.
Fork of mbed by
AnalogIn.h
- Committer:
- simon.ford@mbed.co.uk
- Date:
- 2008-11-27
- Revision:
- 4:5d1359a283bc
- Parent:
- 1:6b7f447ca868
- Child:
- 5:62573be585e9
File content as of revision 4:5d1359a283bc:
/* mbed Microcontroller Library - AnalogIn * Copyright (c) 2007-2008, sford */ #ifndef MBED_ANALOGIN_H #define MBED_ANALOGIN_H #include "Base.h" namespace mbed { /* Class: AnalogIn * An analog input, used for reading the voltage on a pin */ class AnalogIn : public Base { public: /* Group: Configuration Methods */ /* Constructor: AnalogIn * Create an AnalogIn connected to the specified pin * * Variables: * pin - AnalogIn pin to connect to (15-20) */ AnalogIn(int pin, const char *name = NULL); /* Group: Access Methods */ /* Function: read * Read the input, measured as a percentage (float) * * Variables: * returns - A floating-point value representing the current input voltage, * measured as a percentage. The returned value will lie between * 0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%). */ float read(); /* Function: read_v * Read the input, measured in volts (float) * * Variables: * returns - A floating-point value representing the current input voltage, * measured in volts. The returned value will lie between * 0.0f (representing 0v / 0%) and 3.3f (representing 3.3v / 100%). */ float read_v(); /* Function: read_mv * Read the input, measured in milli-volts (int) * * Variables: * returns - An integer value representing the current input voltage, * measured in milli-volts. The returned value will lie between * 0 (representing 0v / 0%) and 3300 (representing 3.3v / 100%). */ int read_mv(); /* Group: Access Methods Shorthand */ /* Function: operator float * A shorthand for <read> */ operator float(); virtual const struct rpc_method *rpc_methods(); protected: int _id; }; } #endif