I have explained my compilation issue in the first comment block /* */.
I have combined examples for the TC mux and the AH10. I don't understand the compilation error. Please advise.
My Code
/* Jim Moroz's attempt to combine mux and AHT examples
copied and pasted from the library examples code from:
-
BasicUaageini from the TCA9548A
-
adafruit_aht10_testlib from the Adafruit AHT10
My compile error:
Cc:\Users\jgmor\OneDrive\Documents\Arduino\TCA and AHT V1\TCA and AHT V1.ino:15:43: error: missing terminating > character
I2CMux.closeAll(); // Set a base state which we know (also the default state on power on)
^
Compilation error: Error: 2 UNKNOWN: exit status 1
*/
#include "TCA9548A.h" // Lib for mux
#include <Adafruit_AHT10.h // Lib for AHT
#include <Wire.h> // Included this library because of a compillation error
TCA9548A I2CMux; // Address can be passed into the constructor
Adafruit_AHTX0 aht; //aht is an object of type Adafruit_AHTX0. Adafruit_AHTX0 is a class declared by the "Adafruit AHTX0" library
void setup() {
Serial.begin(9600);
// IGNORED: Wire.setPins(21, 22); // ESP32 users, use setPins(sda, scl) if customised, before passing Wire to the library (the line below).
I2CMux.begin(Wire); // Wire instance is passed to the library
I2CMux.closeAll(); // Set a base state which we know (also the default state on power on)}
void loop()
{
I2CMux=0x70; //hex address of the mux HMC5883L via I2C
I2CMux.openChannel(0);
/* Code to interactive with revealed address on bus */
sensors_event_t humidity, temp;
aht.getEvent(&humidity, &temp);// populate temp and humidity objects with fresh data
Serial.println("Chan 0 Temperature: "); Serial.println(temp.temperature); Serial.println(" degrees C");
Serial.println("Chan 0 Humidity: "); Serial.println(humidity.relative_humidity); Serial.println("% rH");
I2CMux.closeChannel(0);
I2CMux.openChannel(1);
sensors_event_t humidity, temp;
aht.getEvent(&humidity, &temp);// populate temp and humidity objects with fresh data
Serial.println("Chan 1 Temperature: "); Serial.println(temp.temperature); Serial.println(" degrees C");
Serial.println("Chan 1 Humidity: "); Serial.println(humidity.relative_humidity); Serial.println("% rH");
I2CMux.closeChannel(1);
Delay (500);
}
Thanks
Jim