Here's a good one!
Teensy with i2c_driver as client (address 9)
Code:
//#include <Wire.h>
#include <Arduino.h>
#include <i2c_driver.h>
#include <i2c_driver_wire.h>
#include <EasyTransferI2C.h>
and Arduino with wire as master
Code:
#include <Wire.h>
//#include <Arduino.h>
//#include <i2c_driver.h>
//#include <i2c_driver_wire.h>
#include <EasyTransferI2C.h>
gives an i2c_scanner result of
Code:
09:52:04.777 ->
09:52:04.777 -> I2C Scanner
09:52:04.777 -> Scanning...
09:52:04.777 -> I2C device found at address 09 !
09:52:04.809 -> done
Teensy with wire as master with i2c_scanner
Code:
#include <Wire.h>
//#include <Arduino.h>
//#include <i2c_driver.h>
//#include <i2c_driver_wire.h>
//#include <EasyTransferI2C.h>
and arduino with wire as client (address 9)
gives an i2c_scanner result of
Code:
10:03:55.468 ->
10:03:55.468 -> I2C Scanner
10:03:55.468 -> Scanning...
10:03:55.468 -> I2C device found at address 09 !
10:03:55.468 -> done
Then we invert the i2c_driver/wire usage for the teensy running i2c_scanner
Code:
//#include <Wire.h>
#include <Arduino.h>
#include <i2c_driver.h>
#include <i2c_driver_wire.h>
//#include <EasyTransferI2C.h>
We get this:
Code:
10:06:10.276 -> Scanning...
10:06:10.276 -> I2C device found at address 01 !
10:06:10.276 -> I2C device found at address 02 !
10:06:10.276 -> I2C device found at address 03 !
10:06:10.276 -> I2C device found at address 04 !
10:06:10.276 -> I2C device found at address 05 !
10:06:10.276 -> I2C device found at address 06 !
10:06:10.276 -> I2C device found at address 07 !
10:06:10.276 -> I2C device found at address 08 !
10:06:10.276 -> I2C device found at address 09 !
10:06:10.276 -> I2C device found at address 010 !
10:06:10.276 -> I2C device found at address 011 !
10:06:10.276 -> I2C device found at address 012 !
10:06:10.276 -> I2C device found at address 013 !
10:06:10.276 -> I2C device found at address 014 !
10:06:10.276 -> I2C device found at address 015 !
10:06:10.276 -> I2C device found at address 016 !
10:06:10.276 -> I2C device found at address 017 !
10:06:10.276 -> I2C device found at address 018 !
10:06:10.276 -> I2C device found at address 019 !
10:06:10.276 -> I2C device found at address 020 !
10:06:10.276 -> I2C device found at address 021 !
10:06:10.276 -> I2C device found at address 022 !
10:06:10.276 -> I2C device found at address 023 !
10:06:10.276 -> I2C device found at address 024 !
10:06:10.276 -> I2C device found at address 025 !
10:06:10.276 -> I2C device found at address 026 !
10:06:10.276 -> I2C device found at address 027 !
10:06:10.276 -> I2C device found at address 028 !
10:06:10.276 -> I2C device found at address 029 !
10:06:10.276 -> I2C device found at address 030 !
10:06:10.276 -> I2C device found at address 031 !
10:06:10.276 -> I2C device found at address 032 !
10:06:10.276 -> I2C device found at address 033 !
10:06:10.276 -> I2C device found at address 034 !
10:06:10.276 -> I2C device found at address 035 !
10:06:10.276 -> I2C device found at address 036 !
10:06:10.276 -> I2C device found at address 037 !
10:06:10.276 -> I2C device found at address 038 !
10:06:10.276 -> I2C device found at address 039 !
10:06:10.276 -> I2C device found at address 040 !
10:06:10.276 -> I2C device found at address 041 !
10:06:10.276 -> I2C device found at address 042 !
10:06:10.276 -> I2C device found at address 043 !
10:06:10.276 -> I2C device found at address 044 !
10:06:10.276 -> I2C device found at address 045 !
10:06:10.276 -> I2C device found at address 046 !
10:06:10.276 -> I2C device found at address 047 !
10:06:10.276 -> I2C device found at address 048 !
10:06:10.276 -> I2C device found at address 049 !
10:06:10.276 -> I2C device found at address 050 !
10:06:10.276 -> I2C device found at address 051 !
10:06:10.276 -> I2C device found at address 052 !
10:06:10.276 -> I2C device found at address 053 !
10:06:10.276 -> I2C device found at address 054 !
10:06:10.276 -> I2C device found at address 055 !
10:06:10.276 -> I2C device found at address 056 !
10:06:10.276 -> I2C device found at address 057 !
10:06:10.276 -> I2C device found at address 058 !
10:06:10.276 -> I2C device found at address 059 !
10:06:10.276 -> I2C device found at address 060 !
10:06:10.276 -> I2C device found at address 061 !
10:06:10.276 -> I2C device found at address 062 !
10:06:10.276 -> I2C device found at address 063 !
10:06:10.276 -> I2C device found at address 064 !
10:06:10.276 -> I2C device found at address 065 !
10:06:10.276 -> I2C device found at address 066 !
10:06:10.276 -> I2C device found at address 067 !
10:06:10.276 -> I2C device found at address 068 !
10:06:10.276 -> I2C device found at address 069 !
10:06:10.276 -> I2C device found at address 070 !
10:06:10.276 -> I2C device found at address 071 !
10:06:10.276 -> I2C device found at address 072 !
10:06:10.276 -> I2C device found at address 073 !
10:06:10.276 -> I2C device found at address 074 !
10:06:10.276 -> I2C device found at address 075 !
10:06:10.276 -> I2C device found at address 076 !
10:06:10.276 -> I2C device found at address 077 !
10:06:10.276 -> I2C device found at address 078 !
10:06:10.276 -> I2C device found at address 079 !
10:06:10.276 -> I2C device found at address 080 !
10:06:10.276 -> I2C device found at address 081 !
10:06:10.276 -> I2C device found at address 082 !
10:06:10.276 -> I2C device found at address 083 !
10:06:10.276 -> I2C device found at address 084 !
10:06:10.276 -> I2C device found at address 085 !
10:06:10.276 -> I2C device found at address 086 !
10:06:10.276 -> I2C device found at address 087 !
10:06:10.276 -> I2C device found at address 088 !
10:06:10.276 -> I2C device found at address 089 !
10:06:10.276 -> I2C device found at address 090 !
10:06:10.276 -> I2C device found at address 091 !
10:06:10.276 -> I2C device found at address 092 !
10:06:10.276 -> I2C device found at address 093 !
10:06:10.276 -> I2C device found at address 094 !
10:06:10.276 -> I2C device found at address 095 !
10:06:10.276 -> I2C device found at address 096 !
10:06:10.276 -> I2C device found at address 097 !
10:06:10.276 -> I2C device found at address 098 !
10:06:10.276 -> I2C device found at address 099 !
10:06:10.276 -> I2C device found at address 0100 !
10:06:10.276 -> I2C device found at address 0101 !
10:06:10.276 -> I2C device found at address 0102 !
10:06:10.276 -> I2C device found at address 0103 !
10:06:10.276 -> I2C device found at address 0104 !
10:06:10.276 -> I2C device found at address 0105 !
10:06:10.276 -> I2C device found at address 0106 !
10:06:10.276 -> I2C device found at address 0107 !
10:06:10.276 -> I2C device found at address 0108 !
10:06:10.276 -> I2C device found at address 0109 !
10:06:10.276 -> I2C device found at address 0110 !
10:06:10.276 -> I2C device found at address 0111 !
10:06:10.276 -> I2C device found at address 0112 !
10:06:10.276 -> I2C device found at address 0113 !
10:06:10.276 -> I2C device found at address 0114 !
10:06:10.276 -> I2C device found at address 0115 !
10:06:10.276 -> I2C device found at address 0116 !
10:06:10.276 -> I2C device found at address 0117 !
10:06:10.276 -> I2C device found at address 0118 !
10:06:10.276 -> I2C device found at address 0119 !
10:06:10.276 -> I2C device found at address 0120 !
10:06:10.276 -> I2C device found at address 0121 !
10:06:10.276 -> I2C device found at address 0122 !
10:06:10.276 -> I2C device found at address 0123 !
10:06:10.276 -> I2C device found at address 0124 !
10:06:10.276 -> I2C device found at address 0125 !
10:06:10.276 -> I2C device found at address 0126 !
10:06:10.276 -> done
Sanity check, revert to using wire on the teensy result:
Code:
10:14:42.738 ->
10:14:42.738 -> I2C Scanner
10:14:42.738 -> Scanning...
10:14:42.738 -> I2C device found at address 09 !
10:14:42.738 -> done
10:14:42.738 ->
i2c_scanner implementation: (RX/client code used is as above)
Code:
// --------------------------------------
// i2c_scanner
//
// Version 1
// This program (or code that looks like it)
// can be found in many places.
// For example on the Arduino.cc forum.
// The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
// Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26 2013
// V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
// by Arduino.cc user Krodal.
// Changes by louarnold removed.
// Scanning addresses changed from 0...127 to 1...119,
// according to the i2c scanner by Nick Gammon
// https://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
// As version 4, but address scans now to 127.
// A sensor seems to use address 120.
// Version 6, November 27, 2015.
// Added waiting for the Leonardo serial communication.
//
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//
//#include <Wire.h>
#include <Arduino.h>
#include <i2c_driver.h>
#include <i2c_driver_wire.h>
#include <EasyTransferI2C.h>
void setup()
{
Wire.begin();
Serial.begin(9600);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println("\nI2C Scanner");
}
void loop()
{
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0");
//if (address<16)
//Serial.print("0");
Serial.print(address);
Serial.println(" !");
nDevices++;
}
else if (error==4)
{
Serial.print("Unknown error at address ");
//if (address<16)
// Serial.print("0");
Serial.println(address);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(5000); // wait 5 seconds for next scan
}