Rizky Ardi Maulana / mbed-os
Embed: (wiki syntax)

« Back to documentation index

BatteryLevel Class Reference

BatteryLevel Class Reference
[Drivers]

An analog input, used for reading the voltage on a pin. More...

#include <AnalogIn.h>


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 54 of file AnalogIn.h.