An I2C Scanner, to test that your I2C can be detected. Works with the NRF51 Development Kit.
Dependencies: mbed-src-nrf51822
Revision 1:117c1bb3ce43, committed 2016-06-30
- Comitter:
- Cannonball2134
- Date:
- Thu Jun 30 07:43:22 2016 +0000
- Parent:
- 0:839b7264c387
- Commit message:
- Working I2C Scanner on the NRF51-DK
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 839b7264c387 -r 117c1bb3ce43 main.cpp --- a/main.cpp Thu Jun 09 11:06:51 2016 +0000 +++ b/main.cpp Thu Jun 30 07:43:22 2016 +0000 @@ -4,7 +4,7 @@ #define SCL 7 #define SDA 30 -TwoWire Wire = TwoWire(NRF_TWI0); +TwoWire Wire = TwoWire(NRF_TWI1); int main(void) { @@ -23,7 +23,7 @@ if (error == 0) { - printf("I2C device found at address 0x%X %d \n\r", address, error); //Returns 7-bit address + printf("I2C device found at address %d 0x%X %d \n\r",address, address, error); //Returns 7-bit address nDevices++; } }