Who_am_I readtest

Dependencies:   mbed

Files at this revision

API Documentation at this revision

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
--- /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]);
+}
--- /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