### Enable HC4051 Multiplexer Source: https://github.com/robtillaart/hc4051/blob/master/README.md Enable the HC4051 multiplexer to start multiplexing. This function is only effective if an enable pin was configured during construction. ```cpp void enable() ``` -------------------------------- ### Channel Selection Source: https://github.com/robtillaart/hc4051/blob/master/README.md Functions to set and get the current channel of the HC4051 multiplexer. Channel values range from 0 to 7. ```APIDOC ## Channel Selection ### Description Manages the selection of channels on the HC4051 multiplexer. The `setChannel` function allows switching to a specific channel (0-7) and optionally controls whether the device is disabled during the switch. The `getChannel` function returns the currently selected channel. ### setChannel #### Signature bool setChannel(uint8_t channel, bool disable = true) #### Parameters - **channel** (uint8_t) - Required - The channel to select (0-7). - **disable** (bool) - Optional - If true, the device is disabled during channel switching. Defaults to true. #### Returns - bool - Returns false if the channel is out of range; otherwise, true. ### getChannel #### Signature uint8_t getChannel() #### Returns - uint8_t - The currently selected channel (0-7). ``` -------------------------------- ### Get Current Channel Source: https://github.com/robtillaart/hc4051/blob/master/README.md Retrieve the currently selected channel (0-7) from the HC4051 multiplexer. This function returns the channel even if the multiplexer is disabled. ```cpp uint8_t getChannel() ``` -------------------------------- ### Initialize HC4051 with Select and Enable Pins Source: https://github.com/robtillaart/hc4051/blob/master/README.md Construct an HC4051 object by specifying the digital pins for select lines A, B, and C, and optionally an enable pin. If no enable pin is used, set it to 255. ```cpp HC4051(uint8_t A, uint8_t B, uint8_t C, uint8_t enablePin = 255) ``` -------------------------------- ### HC4051 Constructor Source: https://github.com/robtillaart/hc4051/blob/master/README.md Initializes the HC4051 multiplexer. You must specify the three select pins (A, B, C) and can optionally provide an enable pin. ```APIDOC ## HC4051 Constructor ### Description Initializes the HC4051 multiplexer by setting the three select pins and an optional enable pin. If the enable pin is not used, it can be set to 255. ### Signature HC4051(uint8_t A, uint8_t B, uint8_t C, uint8_t enablePin = 255) ``` -------------------------------- ### Include HC4051 Library Source: https://github.com/robtillaart/hc4051/blob/master/README.md Include the necessary header file for the HC4051 library at the beginning of your sketch. ```cpp #include "HC4051.h" ``` -------------------------------- ### HC4051 Hardware Connection Diagram Source: https://github.com/robtillaart/hc4051/blob/master/README.md Illustrates the typical wiring between a processor and the HC4051 multiplexer, showing connections for select pins, enable pin, analog input, and ground. ```text processor HC4051 +-------------+ +-------------+ | | | | | A |------------->| S0 Y0 | | B |------------->| S1 Y1 | | C |------------->| S2 Y2 | | | | Y3 | | E |------------->| INH Y4 | | | | Y5 | | A0 |<-------------| Y Y6 | | | | Y7 | | GND |--------------| GND Y8 | | | | VCC | | | | | +-------------+ +-------------+ ``` -------------------------------- ### Check if HC4051 is Enabled Source: https://github.com/robtillaart/hc4051/blob/master/README.md Check the current status of the HC4051 multiplexer. Returns true if the device is enabled or if no enable pin was set during initialization. ```cpp bool isEnabled() ``` -------------------------------- ### Enable/Disable Control Source: https://github.com/robtillaart/hc4051/blob/master/README.md Functions to enable, disable, and check the status of the HC4051 multiplexer. These functions are only active if an enable pin was configured during construction. ```APIDOC ## Enable/Disable Control ### Description Provides control over the enabled state of the HC4051 multiplexer. These functions require an `enablePin` to be set during initialization. The `enable` function activates the multiplexer, `disable` deactivates it, and `isEnabled` checks its current status. ### enable #### Signature void enable() ### disable #### Signature void disable() ### isEnabled #### Signature bool isEnabled() #### Returns - bool - True if the device is enabled or if no enable pin was configured; false otherwise. ``` -------------------------------- ### Set Current Channel Source: https://github.com/robtillaart/hc4051/blob/master/README.md Select a specific channel (0-7) on the HC4051 multiplexer. The function returns false if the channel is out of range. By default, the device is disabled during switching to prevent ghost channels, but this can be overridden. ```cpp bool setChannel(uint8_t channel, bool disable = true) ``` -------------------------------- ### Disable HC4051 Multiplexer Source: https://github.com/robtillaart/hc4051/blob/master/README.md Disable the HC4051 multiplexer, ensuring no channel is selected. This function requires a configured enable pin. ```cpp void disable() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.