feat: added configurations for i2c communication between devices

This commit is contained in:
SWETRAK
2026-07-03 23:02:53 +02:00
parent f587dafb15
commit 3eb119f6a2
13 changed files with 191 additions and 8 deletions
+8 -1
View File
@@ -1 +1,8 @@
# Architektoniczne perełki Lublina - Slave 3
# Architektoniczne perełki Lublina - Slave 3
## I2C
Pins:
- SDA -> 21
- SCL -> 22
Address: 0x0A
+19 -1
View File
@@ -1,11 +1,29 @@
#include <Arduino.h>
#include <Wire.h>
#define SDA_PIN 21
#define SCL_PIN 22
#define SLAVE_ADDRESS 0x0A
void requestEvent();
void setup()
{
Serial.begin(115200);
Wire.begin(SDA_PIN, SCL_PIN, SLAVE_ADDRESS); // Initialize I2C with specified SDA and SCL pins
Wire.onRequest(requestEvent);
}
void loop()
{
// put your main code here, to run repeatedly:
}
void requestEvent()
{
// TODO: Send data to the master when requested
Serial.println("Master requested data from Slave.");
Wire.write("Hello from Slave!");
}