Ciaran Doyle
/
i2c_read
i2c
Revision 0:cbf763d04f7a, committed 2020-07-18
- 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 |
diff -r 000000000000 -r cbf763d04f7a main.cpp --- /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()); +}
diff -r 000000000000 -r cbf763d04f7a mbed.bld --- /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