Function gpio_rust::gpio::turn_off[][src]

pub fn turn_off(pin: u8) -> Result<(), String>
Expand description

A stand-alone function used to turn off a specified GPIO pin that is already on. Once a pin is turned off, it will stop emitting any electrical current. If you attempt to turn off a pin that is already off then nothing will happen.

This function takes an unsigned 8-bit integer as an argument. The argument is used to specify which pin on the PI to turn off.

Returns a Result type which is either empty or contains a String datatype. The String may contain a an error message to aid in debugging.

Example:

match turn_off(1) {
    Ok(()) => {
        println!("The pin is now off!");
    },
    Err(msg) => {
        println!("The pin could not be turn off: {}", msg);
    }
};