Who_am_I readtest
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:213f9a70f694
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jul 12 12:49:50 2018 +0000 @@ -0,0 +1,14 @@ +#include "mbed.h" + +I2C i2c(p9,p10); +Serial pc(USBTX, USBRX); +const int addr = 0x68;//KP-9250のスレーブアドレス +char cmd[2]; +char get[2]; + +int main() { + cmd[0] = 0x75; + i2c.write(addr,cmd,1); + i2c.read(addr,get,1); + pc.printf("%d\n\r",get[0]); +}