title: I2C Not working with PCA9685
body: <p>I'm using an Atmega168 I'm attempting to use I2C with my PCA9685 Servo driver.</p>
  
  <p>I'm using this I2C library: <a href="https://github.com/g4lvanix/I2C-master-lib" rel="nofollow noreferrer">https://github.com/g4lvanix/I2C-master-lib</a></p>
  
  <p>I'm attempting to start the I2C connection with my PCA9685 (Address: 0x41).</p>
  
  <p>For some reason the I2C Library is bouncing back an error because the acknowledge bit isn't being sent. What is wrong here? My SDA and SCL pins are hooked up to 10k pull up resistors, and they are connected to the PCA9685 correctly. Yet it still isn't working. Could it be my PCA9685 chip? I also know the address is 0x41 because I manually bridged an address connection to assign that address.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#include &lt;avr/io.h&gt;
  #include &lt;util/delay.h&gt;
  #include &lt;avr/interrupt.h&gt;
  #include &lt;avr/power.h&gt;
  #include "i2c.h"
  
  #define SERVO_MIN 1000
  #define SERVO_MAX 2000
  #define SERVO_MID 1500
  
  #define PCA9685_ADDR 0x40
  
  #define PCA9685_MODE1 0x0
  
  #define LED0_ON_L 0x6
  #define LED0_ON_H 0x7
  #define LED0_OFF_L 0x8
  #define LED0_OFF_H 0x9
  
  #define LED      PB0
  #define LED_DDR  DDRB
  #define LED_PORT PORTB
  
  #define DELAYTIME 200
  
  #define setBit(sfr, bit)     (_SFR_BYTE(sfr) |= (1 &lt;&lt; bit))
  #define clearBit(sfr, bit)   (_SFR_BYTE(sfr) &amp;= ~(1 &lt;&lt; bit))
  #define toggleBit(sfr, bit)  (_SFR_BYTE(sfr) ^= (1 &lt;&lt; bit))
  
  
  void setupController();
  void setServo(uint8_t id, uint8_t start, uint8_t stop);
  int main(void)
  {
    setBit(LED_DDR, LED);
    clock_prescale_set(clock_div_1);
    i2c_init();
    uint8_t err = i2c_start(0x41);
  
    while(err == 1) {
      setBit(LED_PORT, LED);
      uint8_t err = i2c_start(0x41);
  
    }
    clearBit(LED_PORT, LED);
    while(1) {
  
  }
    return 0;
  }
  </code></pre>
  
  <p>Thank you in advance!</p>