Help reading i2c data from device

I have a hardware device that I am trying to read (monitor and send to serial port) but I can’t get it to work at all. I am new to i2c. I have been playing with the slave i2c receiver example. I think whats throwing me off is that the data is located after the read command and the example uses the write command? Maybe someone can help me with this. Here is am example of the data I am trying to read. The last 4 bytes are what I need. Nothing else will be on this bus.

Here is the example code I was playing with. I tried using"Wire.begin(2);" and Wire.begin(3);

// Wire Slave Receiver
// by Nicholas Zambetti <http://www.zambetti.com>

// Demonstrates use of the Wire library
// Receives data as an I2C/TWI slave device
// Refer to the "Wire Master Writer" example for use with this

// Created 29 March 2006

// This example code is in the public domain.


#include <Wire.h>

void setup()
{
  Wire.begin(2);                // join i2c bus with address #2
  Wire.onReceive(receiveEvent); // register event
  Serial.begin(9600);           // start serial for output
}

void loop()
{
  delay(100);
}

// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany)
{
  while (1 < Wire.available()) // loop through all but the last
  {
    char c = Wire.read(); // receive byte as a character
    Serial.print(c);         // print the character
  }
  int x = Wire.read();    // receive byte as an integer
  Serial.println(x);         // print the integer
}

I have a hardware device that I am trying to read

What are you trying to read data from? Can you provide a link to its data sheet?

Here is the only English datasheet for this device. I am basically wanting to monitor the LED readout thats coming from the stm32 cpu so I can trigger an event based on whats being displayed. The interface looks like its i2c but maybe I am wrong?

TM1637.pdf (729 KB)

I also found this library that does work for writing to the display but I am looking to read the data. Ultimately I plan to basically become a man in the middle. I will read the incoming display data and trigger an event and then write my own data to the display.

TM1637-master.zip (8.03 KB)

Neither the library you linked, or any of the other libraries for the TM1637 display and Arduino which I could find with Google use Wire.h to write to the display controller. I would guess that the authors have written their own protocols because Wire.h does not work with this device.

It is also not clear to me that the read mode noted in the data sheet can be used to externally view the registers, and it maybe more for the device to read the keypad.

I do not think I can be of much help.

Well when I log the data I am able to see the 3 bytes of data after the read byte are the values for each of the digits in the LED display. The 4th bight sets the brightness of the display. I am really hoping that someone out there can give me a hand with this as its a little beyond me to figure out how to read this data in.

I also found this...

From what I am reading on the spec of i2c. The reason its not working is because the start bit is set to read and it needs to be write in order to start reading the data. So my first thought is can I mod the wire library to look for that flipped bit so that it will look for the read start bit and not the write?