Who_am_I readtest
Dependencies: mbed
Revision 0:213f9a70f694, committed 2018-07-12
- Comitter:
- ponpoko1939
- Date:
- Thu Jul 12 12:49:50 2018 +0000
- Commit message:
- Who_am_I read
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 213f9a70f694 main.cpp --- /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]); +}
diff -r 000000000000 -r 213f9a70f694 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Jul 12 12:49:50 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/a7c7b631e539 \ No newline at end of file