I2C conflict with Serial1 on Arduino Micro

Hi,

Encountered an issue with using serial1 and I2C on the Arduino Micro.

My program is to read data from the Serial1. It works perfectly until I added a function to read data from the I2C device.

The data read from the I2C device works fine but not the serial1.

I've added pull up resistors on the I2C bus but it does not help in solving the problem.

Advice would be appreciated.

Please don't crosspost. Duplicate post deleted.

My program is

missing, so we can only assume that it is wrong.

Before adding in the reading of the Lidar Lite, i am able to read the data from serial1. However, after adding in the portion to read the distance from the Lidar Lite via I2C, I am not able to read the serial data from serial1.

auto2.ino (12.8 KB)

Go to love useless comments:

  // setting registers
  TCCR1A = _BV(COM1A1) | _BV(COM1B1);
  TCCR1B = _BV(WGM13) | _BV(CS11);
  ICR1 = PWMConst;

It would be far more useful to say what you are really trying to accomplish.

A schematic will, I think, be necessary.

paperbert:
Before adding in the reading of the Lidar Lite, i am able to read the data from serial1. However, after adding in the portion to read the distance from the Lidar Lite via I2C, I am not able to read the serial data from serial1.

Why are you using 2 I2C libraries?

#include <I2C.h>
#include <Servo.h>
#include <string.h>
#include <Timer.h>
#include <Wire.h>

I2C.h is not a standard library included with Arduino, please attach links, and or references.

Chuck.