update examples

This commit is contained in:
Rob Tillaart 2024-06-12 11:59:23 +02:00
parent 35e3f3f481
commit c607f160bd
4 changed files with 67 additions and 6 deletions

View File

@ -6,10 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.3.1] - 2024-xx-xx
- update examples
## [0.3.0] - 2023-12-05
- remove **begin(sda, scl)** to have less board specific dependencies.
----
## [0.2.1] - 2023-09-24

View File

@ -23,6 +23,8 @@ void setup()
for (int addr = 0; addr < 128; addr++)
{
Serial.print(addr, HEX);
Serial.print("\t");
Serial.print(addr);
Serial.print("\t");
Serial.println(scanner.ping(addr));

View File

@ -0,0 +1,57 @@
// FILE: I2C_scanner_multi_speed.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo minimal I2C scanner
// URL: https://github.com/RobTillaart/I2C_SCANNER
#include "I2C_SCANNER.h"
I2C_SCANNER scanner;
void setup()
{
Serial.begin(115200);
while (!Serial);
Serial.println();
Serial.println(__FILE__);
Serial.print("I2C_SCANNER_LIB_VERSION: ");
Serial.println(I2C_SCANNER_LIB_VERSION);
Serial.println();
Wire.begin();
Wire.setClock(100000);
scanner.begin();
for (int addr = 0; addr < 128; addr++)
{
Wire.setClock(100000);
int x = scanner.ping(addr);
Serial.print(addr, HEX);
Serial.print("\t");
Serial.print(addr);
Serial.print("\t");
Serial.println(x);
if (x == 0)
{
for (uint32_t cl = 100000; cl <= 600000; cl += 50000)
{
Wire.setClock(cl);
Serial.print("\t");
Serial.print(cl);
Serial.print("\t");
Serial.println(scanner.ping(addr));
}
}
}
Wire.setClock(100000);
}
void loop()
{
}
// -- END OF FILE --

View File

@ -20,7 +20,11 @@ void setup()
Wire.begin();
scanner.begin();
}
void loop()
{
for (int addr = 0; addr < 128; addr++)
{
if (addr % 8 == 0) Serial.println();
@ -36,11 +40,7 @@ void setup()
}
Serial.println();
Serial.println();
}
void loop()
{
delay(1000);
}