From c7b3b176e9922b4c5a7fa6416f4c67fce41d9248 Mon Sep 17 00:00:00 2001 From: Atlas-Scientific <20248527+Atlas-Scientific@users.noreply.github.com> Date: Wed, 29 Apr 2020 17:34:16 -0400 Subject: [PATCH] added the get_address() method to the class --- Ezo_i2c.cpp | 4 ++++ Ezo_i2c.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Ezo_i2c.cpp b/Ezo_i2c.cpp index 6288c4c..dbf9d5c 100644 --- a/Ezo_i2c.cpp +++ b/Ezo_i2c.cpp @@ -17,6 +17,10 @@ const char* Ezo_board::get_name(){ return this->name; } +uint8_t Ezo_board::get_address(){ + return i2c_address; +} + void Ezo_board::send_cmd(const char* command) { Wire.beginTransmission(this->i2c_address); Wire.write(command); diff --git a/Ezo_i2c.h b/Ezo_i2c.h index 6fdb022..29f6d42 100644 --- a/Ezo_i2c.h +++ b/Ezo_i2c.h @@ -83,6 +83,10 @@ class Ezo_board{ //returns the error status of the last received command, //used to check the validity of the data returned by get_reading() + uint8_t get_address(); + //returns the address of the device + + protected: uint8_t i2c_address; const char* name = 0;