#include <zephyr/kernel.h>
#include <zephyr/drivers/i2c.h>

#define I2C_NODE DT_NODELABEL(mysensor)

static const struct i2c_dt_spec dev_i2c = I2C_DT_SPEC_GET(I2C_NODE);
uint8_t config[5] = "hello";

int main(void)
{
	printk("RESERTTTTTTTT\n\r");
        int ret;
        if (!device_is_ready(dev_i2c.bus)) 
        {
                printk("I2C bus %s is not ready!\n\r",dev_i2c.bus->name);
                return -1;
        }   

        while (1) 
        {
                ret = i2c_write_dt(&dev_i2c, config, sizeof(config));
                if(ret != 0){
                        printk("Failed to write to I2C device address %x at reg. %x \n\r", dev_i2c.addr, config[0]);
                }
                else{
                        printk("Success to write %u bytes\r\n", sizeof(config));
                }
                k_msleep(5000);
        }

        return 0;
}
