I have an Arduino Pro Micro(blue version) and I'm having trouble using the I2C. To test it, I use the code below and the result is an infinite square wave on SCL and SDA lines and I only get the number 1 on the terminal output. I have pullup resistors on both wires, 2k each. Since the board uses an ATMEGA32U4, I tried the same code on a bare MCU and the code works as expected. The difference between the two is the bootloader type. The bare PCB is flashed over USB, using the factory bootloader(ATMEGA32U4-AU, QFP44). By debugging the code, I found out that endTransmission does not return. Does anyone have an idea, why the I2C is not working as expected on the Pro Micro module?
Thanks!
#include <Wire.h>
void setup() {
Serial.begin (115200);
// Leonardo: wait for serial port to connect
while (!Serial)
{
}
Serial.println ();
Serial.println ("I2C scanner. Scanning ...");
byte count = 0;
Wire.begin();
} // end of setup
void loop() {
byte count = 0;
for (byte i = 1; i < 120; i++)
{
Serial.println(i);
Wire.beginTransmission (i);
Wire.endTransmission ();
delay(10);
}
}
1 Answer 1
Seems like the module has a defect, since the same code on another board produces the expected output on the I2C lines
Wire.endTransmission()
blocks?