--- tags: - resource created: 2025-11-06 17:37 --- ## Summary Notes on the use of the [rppal]() crate. ## Notes ### GPIO Pull Up/Pull Down Bias The `rppal::gpio::InputPin::set_bias` method is used to configure the Raspberry Pi's **built-in pull-up or pull-down resistors** on an input pin.  You should use `set_bias` when interfacing with digital input sensors or switches that do not have their own external pull-up/pull-down resistors. These internal resistors ensure the input pin has a defined logic level (either high or low) when the external component is disconnected or floating, preventing erratic readings caused by electrical noise.  | When to Use | Typical Connection | | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | | **`Bias::PullUp`** | When the input is connected to ground (GND) to signal a "low" state (e.g., a button connecting the pin to GND). The resistor pulls the pin voltage up to 3.3V by default. | One side of a button to the GPIO pin, the other side to GND. | | **`Bias::PullDown`** | When the input is connected to 3.3V to signal a "high" state (e.g., a sensor outputting 3.3V). The resistor pulls the pin voltage down to GND by default. | One side of a button to the GPIO pin, the other side to 3.3V. | | **`Bias::Off`** | When the external circuit already provides a defined logic level (e.g., an active sensor with a strong output signal, or an external pull-up/pull-down resistor is used). | Active sensor output connected directly to the GPIO pin. | ## References