All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Solution: Master Code://Header Files #include #include LiquidCrystal lcd(13,12,5,4,3,2); //Create a LiquidCrystal object for the LCD with the specified I2C address void setup() { lcd.begin(16, 2); //Initialize the LCD Wire.begin(); //Initialize the I2C communication } void loop() { int analogValue = analogRead(A0);…
Rishabh Bhojankar
updated on 26 Sep 2023
Solution:
Master Code://Header Files
#include
#include
LiquidCrystal lcd(13,12,5,4,3,2); //Create a LiquidCrystal object for the LCD with the specified I2C address
void setup()
{
lcd.begin(16, 2); //Initialize the LCD
Wire.begin(); //Initialize the I2C communication
}
void loop()
{
int analogValue = analogRead(A0); //Read an analog value from pin A0
byte MasterSend = map(analogValue, 0, 1023, 0, 127); //Map the analog value to a byte range (0-127)
Wire.beginTransmission(8);
Wire.write(MasterSend); //Send the mapped value to the slave
Wire.endTransmission(); //End the I2C transmission
Wire.requestFrom(8, 1);
if (Wire.available())
{
byte SlaveReceived = Wire.read();
lcd.clear(); //Clear the LCD screen
lcd.setCursor(0, 0); //Set the cursor position to the first row, first column
lcd.print(">> Slave <<"); //Display a message indicating communication with the slave
lcd.setCursor(0, 1); //Set the cursor position to the second row, first column
lcd.print("MasterVal:"); //Display a label
lcd.print(SlaveReceived); //Display the value received from the slave
}
delay(1000); //Delay for 1 second
}
Slave Code:
#include
void setup()
{
Wire.begin(8); //Begins I2C communication with Slave Address as 8 at pins A4 and A5
Wire.onRequest(requestEvent);
}
void loop()
{
}
void requestEvent()
{
byte SlaveSend = map(analogRead(A0), 0, 1023, 0, 127);
Wire.write(SlaveSend);
}
Project Link:
https://www.tinkercad.com/things/07hepKLH9t6-project-01/editel?sharecode=rhHhz09oPJ3xx8gy2VXVsSXSf1mU-Px-jSy427tGDHg
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Project 2 - Design and develop the web based Temperature control system using Beagle Bone Black.
Overview of the Project: Device Driver Write the device driver for MCP9808 Temperature Sensor. Probe function: Register the Platform device under driver/misc. Read function: It should send the i2c message to read the data from sensor and copy it to the user space. Alert pin connected to BBB as gpio interrupt. The…
02 Dec 2023 10:59 PM IST
Project 1 - Develop the full featured char driver as a loaded module
Overview of the Project: • Device Driver o Write the device driver for MCP9808 Temperature Sensor. Probe function: Register the Platform device under driver/misc. Read function: It should send the i2c message to read the data from sensor and copy it to the user space. Alert pin connected to BBB as gpio…
01 Dec 2023 10:07 AM IST
Project 3
Que. Program an attack terminal 1. The user should be able to select from the following CAN based attacks a. Full Bus DoS - The program should allow the user to set a duration for the attack b. Partial DoS - The program should ask the user “what priority should I DoS at?” - The program should allow the…
01 Dec 2023 02:28 AM IST
Project 2
Que. Write a program that performs a binary search for any given signal (The instrument cluster can be used as a source for CAN traffic) - It should record a log, assisted by user prompt, and replay all other subsequent logs according to a prompt that the user checks (Did the signal occur again? Y/N) - After every…
30 Nov 2023 10:50 PM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.