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.
I2C.cpp
- Committer:
- Aliceravier
- Date:
- 2020-03-02
- Revision:
- 1:49365ba8f5df
- Parent:
- main.cpp@ 0:a8b9e1427c3d
File content as of revision 1:49365ba8f5df:
#include "mbed.h" I2C i2c(p28, p27); const int addr = 0x90; int main() { printf("the terminal works"); char cmd[2]; while (1) { 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); int output = (cmd[0]<<8)|cmd[1]; printf("Temp = %d\n", output); } }