We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 74b2463 commit e43abedCopy full SHA for e43abed
libraries/Wire/examples/master_scan/master_scan.ino
@@ -0,0 +1,28 @@
1
+#include <Wire.h>
2
+
3
+TwoWire *wi = &Wire;
4
+//TwoWire *wi = &Wire1;
5
6
+void setup()
7
+{
8
+ Serial.begin(115200); // start serial for output
9
+ while ( !Serial ) delay(10); // for nrf52840 with native usb
10
+ wi->begin(); // join i2c bus (address optional for master)
11
+}
12
13
+void loop()
14
15
+ Serial.println("Scanning address from 0 to 127");
16
+ for (int addr = 1; addr < 128; addr++)
17
+ {
18
+ wi->beginTransmission(addr);
19
+ if ( 0 == wi->endTransmission() )
20
21
+ Serial.print("Found: 0x");
22
+ Serial.print(addr, HEX);
23
+ Serial.println();
24
+ }
25
26
27
+ delay(5000);
28
0 commit comments