I2C comunication with Raspberry Pi

Hallo,

I try to send some Data from my Raspberry Pi to my Arduino UNO.
Communication between 2 Arduinos works fine but i cant communicate with my Raspberry.

I don’t know if i do something wrong, an d i hope you can help me. Here the Code of the Uno:

#include <Wire.h>

void setup()
{
  Wire.begin(4);
  Wire.onReceive(receiveEvent);
  Serial.begin(9600);
  pinMode(13,OUTPUT);
  digitalWrite(13,LOW);
}

void loop()
{
  
}

void receiveEvent(int howMany)
{
  while(Wire.available())
  {
    char c = Wire.read();
    Serial.println(c);
    if(c == '3')
    {
      digitalWrite(13,HIGH);
    }
    else if(c == '6')
    {
      digitalWrite(13,LOW);
    }
  }
}

and here is the code from the raspberry:

import os
import smbus
from smbus import SMBus

bus = SMBus(1)
address = 0x04

number = bus.write_block_data(address, 2, [3,4,4,6])
print(number)

In the Serial monitor i only see some boxes…

hope you have a solution for my problem, nevertheless it could python or a Raspberry problem.

Thanks

Problem solved... i recieve an int... and no char.. sometimes your mad :D

sometimes your mad

und manchmal im falschen forum, aber trotzdem herzlich willkommen...