File tree Expand file tree Collapse file tree 3 files changed +66
-1
lines changed
Expand file tree Collapse file tree 3 files changed +66
-1
lines changed Original file line number Diff line number Diff line change 1+
2+ #include < Wire.h>
3+
4+ void setup () {
5+ Serial.begin (115200 );
6+
7+ // Leonardo: wait for serial port to connect
8+ while (!Serial)
9+ {
10+ }
11+
12+ Serial.println ();
13+ Serial.println (" I2C Testing ..." );
14+ byte count = 0 ;
15+
16+ Wire.begin ();
17+ Wire.beginTransmission (0x3C );
18+ Wire.write (0x80 );
19+ Wire.write (0xAF );
20+ Wire.endTransmission ();
21+ Serial.println (" Done." );
22+
23+ } // end of setup
24+
25+ void loop () {}
Original file line number Diff line number Diff line change 1+ // I2C Scanner
2+ // Written by Nick Gammon
3+ // Date: 20th April 2011
4+
5+ #include < Wire.h>
6+
7+ void setup () {
8+ Serial.begin (115200 );
9+
10+ // Leonardo: wait for serial port to connect
11+ while (!Serial)
12+ {
13+ }
14+
15+ Serial.println ();
16+ Serial.println (" I2C scanner. Scanning ..." );
17+ byte count = 0 ;
18+
19+ Wire.begin ();
20+ for (byte i = 8 ; i < 120 ; i++)
21+ {
22+ Wire.beginTransmission (i);
23+ if (Wire.endTransmission () == 0 )
24+ {
25+ Serial.print (" Found address: " );
26+ Serial.print (i, DEC);
27+ Serial.print (" (0x" );
28+ Serial.print (i, HEX);
29+ Serial.println (" )" );
30+ count++;
31+ // delay (1); // maybe unneeded?
32+ } // end of good response
33+ } // end of for loop
34+ Serial.println (" Done." );
35+ Serial.print (" Found " );
36+ Serial.print (count, DEC);
37+ Serial.println (" device(s)." );
38+ } // end of setup
39+
40+ void loop () {}
Original file line number Diff line number Diff line change @@ -6,4 +6,4 @@ sentence=Allows the communication between devices or sensors connected via Two W
66paragraph =
77category =Signal Input/Output
88url =http://arduino.cc/en/Reference/Wire
9- architectures =riscv
9+ architectures =k210
You can’t perform that action at this time.
0 commit comments