title: How to send an array by i2c?
body: <p>I've been trying for several days now to send a python array by i2c.</p>
  
  <pre><code>data = [x,x,x,x] # `x` is a number from 0 to 127.
  bus.write_i2c_block_data(i2c_address, 0, data)
  
  bus.write_i2c_block_data(addr, cmd, array) 
  </code></pre>
  
  <p>In the function above: addr - arduino i2c adress; cmd - Not sure what this is; array - python array of int numbers. <br> Can this be done? What is actually the cmd?</p>
  
  <hr>
  
  <p>FWIW, Arduino code, where I receive the array and put it on the <code>byteArray</code>:</p>
  
  <blockquote>
  <pre><code>void receiveData(int numByte){
      int i = 0;
      while(wire.available()){
          if(i &lt; 4){
              byteArray[i] = wire.read();
              i++;
          }
       }
    }
  </code></pre>
  </blockquote>
  
  <hr>
  
  <p>It gives me this error: <br> <code>bus.write_i2c_block_data(i2c_adress, 0, decodedArray) IOError: [Errno 5] Input/output error.</code> <br>I tried with this: <code>bus.write_byte(i2c_address, value)</code>, and it worked, but only for a <code>value</code> that goes from 0 to 127, but, I need to pass not only a value, but a full array.</p>