I am playing with a multiplexer that will connect to 3 BNO055's. I am working on the basic multiplexer detection and i get a "not declared in this scope" errror on twi.writeTo what should it be declared as ??
#include <Wire.h>
#include <Adafruit_BNO055.h>
#define BNO055_SAMPLERATE_DELAY_MS (20) // Set pause between samples
#define TCAADDR 0x70
void tcaselect(uint8_t i) {
if (i > 7) return;
Wire.beginTransmission(TCAADDR);
Wire.write(1 << i);
Wire.endTransmission();
}
Adafruit_BNO055 bno0 = Adafruit_BNO055(); // Use object bno to hold information
void setup() {
Serial.begin(9600); // open the serial port at 9600 bps:
while (!Serial);
delay(1000);
Wire.begin();
Serial.begin(115200);
Serial.println("\nTCAScanner ready!");
for (uint8_t t=0; t<8; t++) {
tcaselect(t);
Serial.print("TCA Port #"); Serial.println(t);
for (uint8_t addr = 0; addr<=127; addr++) {
if (addr == TCAADDR) continue;
uint8_t data;
if (! twi_writeTo(addr, &data, 0, 1, 1)) {
Serial.print("Found I2C 0x"); Serial.println(addr,HEX);
}
}
}
Serial.println("\ndone");
}
Your project is called "TEST_TEST_TEST" ? with the sketch being "TEST_TEST_TEST.ino" ?
The compiler has a problem at line 40 with the function "twi_writeTo". The compiler says that you want to call it, but that function is not declared somewhere, it does not exist.
Have you gathered little pieces of code from the internet ? The "twi_writeTo" is not a normal Arduino function.
Are you trying to run a I2C Scanner ? Try this one: Arduino Playground - I2cScanner.
Please tell us also which Arduino board that you are using, and which multiplexer and how it is connected.
No, no, you are not, but at Adafruit they are. I am very unhappy that Adafruit is using a low level function of the Arduino Wire libary They should have used the normal functions of the Wire library. The more I think about it, the more I am convinced that they should not have done that.