Hackster is hosting Hackster Cafe: Open Hardware Summit. Watch the stream live on Friday!Hackster is hosting Hackster Cafe: Open Hardware Summit. Stream on Friday!
jehankandt
Published © Apache-2.0

Arduino With LCD Display - I2C Module

How to use SCL and SDA Pins on Arduino UNO

AdvancedFull instructions provided3,501
Arduino With LCD Display - I2C Module

Things used in this project

Story

Read more

Schematics

Arduino 16x2 Display I2C

Arduino 16x2 Display I2C

Code

Arduino 16x2 Display I2C

C/C++
Use SDA SCL pins
//.............JEHANKANDY.....................
#include <Wire.h>

void setup() {
  Serial.begin (9600);

  // Leonardo: wait for serial port to connect
  while (!Serial) 
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  for (byte i = 8; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

Credits

jehankandt
21 projects • 8 followers
Contact

Comments

Please log in or sign up to comment.