Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#include <Wire.h>
#define DEV_ADDR 0x57
unsigned int addr = 0x00;
unsigned int count = 0;
void setup()
{
Serial.begin(57600);
Wire.begin();
delay(1000);
}
void loop()
{
Serial.print("0x");
if(addr<0x0010) Serial.print("0");
if(addr<0x0100) Serial.print("0");
if(addr<0x1000) Serial.print("0");
Serial.print(addr, HEX);
Serial.print(": ");
Wire.beginTransmission(DEV_ADDR);
Wire.write((int)(addr >> 8)); // MSB
Wire.write((int)(addr & 0xFF)); // LSB
Wire.endTransmission();
Wire.requestFrom(DEV_ADDR,32);
while(Wire.available())
{
byte val = Wire.read();
if(val < 0x10)
Serial.print("0");
Serial.print(val, HEX);
Serial.print(" ");
}
Serial.println();
if(count > 254)
while(true);
addr += 32;
count++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment