Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- ShaolinPoutine
- Date:
- 2017-01-11
- Revision:
- 0:656742ec86ae
- Child:
- 1:7f23dfc59683
File content as of revision 0:656742ec86ae:
#include "mbed.h" //read register value I2C i2c(p9, p10); const char reg[1] = {0x0D}; const char device = 0x3A; char data[1]; int main() { i2c.write(device,reg,1,true); i2c.read(device,data,1); printf("Result : %d \r\n", data[1]); /*i2c.read(addr,); cmd[0] = 0x01; cmd[1] = 0x00; i2c.write(addr, cmd, 2); wait(0.5); cmd[0] = 0x00; i2c.write(addr, cmd, 1); i2c.read(addr, cmd, 2); float tmp = (float((cmd[0]<<8)|cmd[1]) / 256.0); printf("Temp = %.2f\n", tmp);*/ }