Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i2c scanner example #8

Open
tcurdt opened this issue Oct 19, 2015 · 4 comments
Open

i2c scanner example #8

tcurdt opened this issue Oct 19, 2015 · 4 comments

Comments

@tcurdt
Copy link

tcurdt commented Oct 19, 2015

would be great to have

@todbot
Copy link
Owner

todbot commented Oct 19, 2015

That's a great suggestion. I'll see about getting something out later this week.
If you need something right now, I think (but haven't tested), you should be able to do:

#include "SoftI2CMaster"
SoftI2CMaster i2c = SoftI2CMaster( 4,5, true );

for( int i=1; i<125; i++ ) {
  int rc = i2c.beginTransmission( i );
  i2c.endTransmission(i);
  if( rc == 0 ) {
    Serial.print("device at address:"); Serial.println(i);
  }
}

@Testato
Copy link
Contributor

Testato commented Oct 19, 2015

On SoftwareWire, the lib that you found on Arduino Library Manager (started by a fork of this lib) is it possible use the standard i2c scanner sketch. The sketch is integrated in the example also.

@tcurdt
Copy link
Author

tcurdt commented Oct 19, 2015

@Testato Aware of that - but thanks :)
@todbot Thanks for the quick help.

This (small correction) does indeed work:

#include "SoftI2CMaster"
SoftI2CMaster i2c = SoftI2CMaster( 4,5, true );

for( int i=1; i<125; i++ ) {
  int rc = i2c.beginTransmission( i );
  i2c.endTransmission();
  if( rc == 0 ) {
    Serial.print("device at address:"); Serial.println(i);
  }
}

@todbot
Copy link
Owner

todbot commented Oct 19, 2015

oops, yeah that's what I meant. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants