10 years, 2 months ago.

Can't initialise i2c

I'm testing a few examples and developing my own code for i2c

include the mbed library with this snippet

#include "mbed.h"

  I2CSlave slave(p9,p10);
  Serial pc(USBTX, USBRX); 

But I always get the same error:

Error: Identifier "p9" is undefined in "main.cpp", Line: 3, Col: 18 Error: Identifier "p10" is undefined in "main.cpp", Line: 3, Col: 21

What's wrong? (Ublox c-027)

1 Answer

10 years, 2 months ago.

p9 is a LPC1768 pin number (pin 9 on the 40 pin board outline), since the ublox board is a different physical shape p9 and p10 aren't defined for it.

This diagram http://mbed.org/platforms/u-blox-C027/ shows that the ublox I2C is on P0_1 and P0_0, try those two and it should work.

Accepted Answer