### readCodes Source: https://vdwulp.github.io/iButtonTag/REFERENCE.html Starts the search for multiple iButtonCode’s on the data line. ```APIDOC ## int8_t readCodes() ### Description Resets the domain to search for iButtonCode’s. This function is needed to start searching for codes again. ### Returns - **1** - At least one iButton detected - **0** - No iButton detected ``` -------------------------------- ### Read iButton ID-code Source: https://vdwulp.github.io/iButtonTag Demonstrates initializing the iButtonTag library on a specific pin and reading the tag ID-code within the main loop. ```cpp #include // Include the library #define PIN_PROBE 2 // Data line connected to pin 2 iButtonTag ibutton( PIN_PROBE ); // Setup iButtonTag on the pin void setup(void) { Serial.begin(9600); } void loop(void) { iButtonCode code; // Variable to store ID-code Serial.println( "Reading... " ); int8_t status = ibutton.readCode( code ); // Try to read ID-code if ( status > 0 ) { // Code read successfully Serial.print( "iButton code read: " ); ibutton.printCode( code ); // ID-code is in variable _code_ Serial.println(); } } ``` -------------------------------- ### nextCode Source: https://vdwulp.github.io/iButtonTag/REFERENCE.html Continues the search for multiple iButtonCode’s on the data line. ```APIDOC ## int8_t nextCode(iButtonCode code) ### Description Continues the search for multiple iButtonCode’s on the data line. Use this to enumerate all iButtonCode’s after calling readCodes. ### Parameters - **code** (iButtonCode) - Required - Variable to store code read from the data line. ### Returns - **1** - Next iButton read successfully - **0** - No more iButtons detected - **-1** - Invalid iButton code (checksum failed) - **-2** - Invalid iButton code (all zeros) ``` -------------------------------- ### Constructor iButtonTag Source: https://vdwulp.github.io/iButtonTag/REFERENCE.html Constructs an iButtonTag object linked to the specified Arduino pin. ```APIDOC ## iButtonTag(uint8_t pin) ### Description Constructs an iButtonTag object linked to the supplied pin. ### Parameters - **pin** (uint8_t) - Required - Arduino pin number this iButtonTag object should be linked to. ``` -------------------------------- ### int8_t writeCode(iButtonCode code, int8_t type, bool check) Source: https://vdwulp.github.io/iButtonTag/REFERENCE.html Writes a new iButtonCode to a (re)writable tag with optional type specification and safety checks. ```APIDOC ## int8_t writeCode(iButtonCode code, int8_t type, bool check) ### Description Writes a new iButtonCode to a (re)writable tag. It is recommended to have only one tag connected during this operation. ### Parameters - **code** (iButtonCode) - Required - The code to be written. - **type** (int8_t) - Optional - iButton (re)writable tag type constant. Default is IBUTTON_UNKNOWN. - **check** (bool) - Optional - Enables pre-write checks. Default is true. ### Returns - **int8_t** - 1: Success; 0: No iButton detected; -1 to -9: Code-related errors; -11 to -19: Type-related errors; -21 to -29: Writing failure. ``` -------------------------------- ### readCode Source: https://vdwulp.github.io/iButtonTag/REFERENCE.html Reads a single iButtonCode from the data line. ```APIDOC ## int8_t readCode(iButtonCode code, bool old) ### Description Reads one single iButtonCode from the data line. Note that this function may return invalid readings if multiple iButtons are connected. ### Parameters - **code** (iButtonCode) - Required - Variable to store code read from the data line. - **old** (bool) - Optional - Setting to true enables compatibility with DS1990 iButton tags. Default is false. ### Returns - **1** - Next iButton read successfully - **0** - No more iButtons detected - **-1** - Invalid iButton code (checksum failed) - **-2** - Invalid iButton code (all zeros) ``` -------------------------------- ### equalCode Source: https://vdwulp.github.io/iButtonTag/REFERENCE.html Tests if two iButtonCode’s are equal. ```APIDOC ## static bool equalCode(iButtonCode a, iButtonCode b) ### Description Tests if two iButtonCode’s are equal. ### Parameters - **a** (iButtonCode) - Required - First code to be tested. - **b** (iButtonCode) - Required - Second code to be tested. ### Returns - **true** - Codes are equal - **false** - Codes are not equal ``` -------------------------------- ### printCode Source: https://vdwulp.github.io/iButtonTag/REFERENCE.html Prints iButtonCode to Serial as hexadecimal byte values. ```APIDOC ## static void printCode(iButtonCode code, bool reverse) ### Description Prints iButtonCode to Serial as hexadecimal byte values. ### Parameters - **code** (iButtonCode) - Required - The code to be printed. - **reverse** (bool) - Optional - Setting to true will reverse the printed code. Default is false. ``` -------------------------------- ### testCode Source: https://vdwulp.github.io/iButtonTag/REFERENCE.html Tests an iButtonCode for validity. ```APIDOC ## static int8_t testCode(iButtonCode code) ### Description Tests iButtonCode for validity. ### Parameters - **code** (iButtonCode) - Required - Code to be tested. ### Returns - **1** - iButton code valid - **-1** - iButton code invalid (checksum failed) - **-2** - iButton code invalid (all zeros) ``` -------------------------------- ### updateChecksum Source: https://vdwulp.github.io/iButtonTag/REFERENCE.html Updates the checksum of an iButtonCode. ```APIDOC ## static void updateChecksum(iButtonCode code) ### Description Updates checksum of iButtonCode to the correct value. ### Parameters - **code** (iButtonCode) - Required - Code to be updated. ``` -------------------------------- ### int8_t detectWritableType() Source: https://vdwulp.github.io/iButtonTag/REFERENCE.html Detects the type of a (re)writable iButton tag by performing multiple tests. Returns a constant indicating the model or an error code. ```APIDOC ## int8_t detectWritableType() ### Description Detects the type of (re)writable iButton tag by checking for known responses. Returns a specific model constant if found. ### Returns - **int8_t** - >0: iButton writable type found; 0: Unknown/not detectable; -1: No iButton detected. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.