Created
June 10, 2017 06:33
-
-
Save brianrumburg/e6b47dee3a11c50afd7429005b0928b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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