I have 2 TMP102 bds connected I2C to my ESP32 Thing Plus. I finally have all the bugs worked out to get the temps and record them on a SD card.
Now am practicing programming functions to use in future projects. I am totally unable to find a way to send the “sensor0” and “sensor1” names to the “TMP102 sensor0” call thru a function call. I finally was able to find a way to send the sensor address to the function thru an array of string addresses but not the sensor name.
This is obviously not a major problem because I can never have more than 4 TMP102 sensors on the I2C wire. But I would like to know what is special about the sensor0, etc. names that they can not be replaced with a string of the same name.
sensor0 is an object; it has functions associated with it, so you can’t just pass a sensor number or name as an argument to the function. I don’t have one to try but something like this may work:
Thanks Mike. That was the point I was missing. I quickly ran your sketch and I got past my hangup. I still have work to do to identify which sensor is which and reference them in Serial.print statements, but that should be easy.
I quickly went into the Arduino reference page to study up on objects, but could not find anything. Do you know where I would go to get more info?