NHD‐0420CW‐AB3 I2C Interface

Comments

1 comment

  • Michael_L

    Perhaps the below code snippets will better assist you:

    const char slave2w = 0x3C;

    void send_packet(unsigned char x)
    {
      unsigned char ix;
     
      Wire.beginTransmission(slave2w);
      for(ix=0;ix<x;ix++)
      {
        Wire.write(tx_packet[ix]);
      }
      Wire.endTransmission();
    }

    void command(unsigned char c)
    {
          tx_packet[0] = 0x00;
          tx_packet[1] = c;
          send_packet(2);
    }

    void data(unsigned char d)
    {
          tx_packet[0] = 0x40;
          tx_packet[1] = d;
          send_packet(2);
    }
    0

Please sign in to leave a comment.