Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions i2cdetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void _printf(const char *format, ...)
va_end(ap);
}

void i2cdetect(uint8_t first, uint8_t last) {
void i2cdetect(TwoWire &wire, uint8_t first, uint8_t last) {
uint8_t i, j, address, error;

// header
Expand All @@ -36,8 +36,8 @@ void i2cdetect(uint8_t first, uint8_t last) {
for (i = 0; i < 16; i++) {
address = i + j*16;
if (address >= first && address <= last) {
Wire.beginTransmission(address);
error = Wire.endTransmission();
wire.beginTransmission(address);
error = wire.endTransmission();
if (error) {
Serial.print(" --");
} else {
Expand Down
8 changes: 6 additions & 2 deletions i2cdetect.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
/*
i2cdetect.h - Arduino library for scanning I2C bus for devices
*/

#ifndef __I2CDETECT_H_
#define __I2CDETECT_H_

void i2cdetect(uint8_t first, uint8_t last);
void i2cdetect();
#include <Wire.h>

void i2cdetect(TwoWire &wire = Wire, uint8_t first = 0x03, uint8_t last = 0x77);

#endif