Hi Everyone,
I'm using nrf52832(Master) SOC and the LIS3DH accelerometer(Slave) for my code development.
And i"m using Mbed as a platform to develop a code.
When I run a I2C scanner code, it indicates - Error: Target "NRF52_DK" is not recognized.
But, LED Blinky code works fine.
Please share your suggestions...
#include "mbed.h"
I2C i2c(I2C_SDA , I2C_SCL );
int main() {
printf("\nI2C Scanner");
while(1) {
int error, address;
int nDevices;
printf("Scanning...\n");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
i2c.start();
error = i2c.write(address << 1); //We shift it left because mbed takes in 8 bit addreses
i2c.stop();
if (error == 1)
{
printf("I2C device found at address 0x%X", address); //Returns 7-bit addres
nDevices++;
}
}
if (nDevices == 0)
printf("No I2C devices found\n");
else
printf("\ndone\n");
wait(5); // wait 5 seconds for next scan
}
}
Thanks & Regards,
Yuvaraj