#include <Wire.h>

void setup() {
    Wire.begin(9); // Устанавливаем адрес слейва
    Wire.onReceive(receiveEvent); // Указываем функцию для обработки приема данных
    Serial.begin(9600);
}

void loop() {
    // Здесь можно добавить другие действия слейва, если необходимо
}

void receiveEvent(int numBytes) {
    while (Wire.available()) {
        uint8_t cmd = Wire.read();
        uint8_t upper_byte = Wire.read();
        uint8_t lower_byte = Wire.read();

        uint16_t cmd_value = (upper_byte << 8) | lower_byte;
        float value = cmd_value / 16.0;

        Serial.print("Received command: 0x");
        Serial.print(cmd, HEX);
        Serial.print(", value: ");
        Serial.println(value);
    }
}