Challenge

Project 1 - Interfacing a 16*2 LCD with Arduino using I2C protocol

Tinker cad link : https://www.tinkercad.com/things/cRJX9gohKKy-project-1/editel?sharecode=iCG1Mj7LbfM24ZFGU0Rp8rkO4eOoBHssGptbAAgJdiI

code:

master code:

// C++ code
// Master code

#include <Wire.h>
#include<LiquidCrystal.h>
LiquidCrystal lcd(2,3,8,9,10,11);

void setup()
{
Wire.begin();
lcd.begin(16,2);
Serial.begin(9600); // start serial for output
}

void loop()
{
lcd.setCursor(0,0);
lcd.print(" Project-1 ");
lcd.setCursor(0,1);
Wire.requestFrom(8,16 );

while (Wire.available())
{
char c = Wire.read();
Serial.print(c);
lcd.print(c);
}

delay(500);
}

slave code:

// C++ code
// Slave code


#include <Wire.h>

void setup() {
Wire.begin(8); // join i2c bus with address #8
Wire.onRequest(requestEvent);
}

void loop() {
delay(100);
}

void requestEvent() {
Wire.write("Trust the Timing ");
}

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.