i2c

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
qaz
Date:
Sat Jul 18 11:55:05 2020 +0000
Commit message:
ic2

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	Sat Jul 18 11:55:05 2020 +0000
@@ -0,0 +1,20 @@
+#include "mbed.h"
+
+I2C i2c(PTE0, PTE1);
+
+char read_sensor_lower_8bit( void )
+{
+    char    v;
+    char    cmd;
+ 
+    cmd    = 0xA0;
+ 
+    i2c.write( 0xD0, &cmd, 1 );
+    i2c.read( 0xD0, &v, 1 );
+ 
+    return( v );
+}
+
+int main() {
+    printf("Got this: %d", read_sensor_lower_8bit());
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Jul 18 11:55:05 2020 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e7ca05fa8600
\ No newline at end of file