.Value( )

back to DigitalInputPin

Description

This function provides read access to the associated DigitalInputPin object. Remember that all DigitalInputPin objects enable an internal pull-up resistor that inverts the value of the pin. This means that, if nothing is connected to a digital input, the value function will return a 1 (true). Then, if your attached peripheral is a standard switch, pressing the switch will return a value of 0 (false).

Parameters

None.

Returns

This function returns a boolean value corresponding to the status of the associated DigitalInputPin.

Examples

#include <FEHIO.h>

int main(void)
{
    //declares a digital input pin on P0_3
    DigitalInputPin bump_switch(FEHIO::P0_3);

    //read the value of the digital input into x
    bool x = bump_switch.Value();
}