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:
- VohlandL
- Date:
- 2018-12-10
- Revision:
- 0:341db01762fe
- Child:
- 1:6cb1e26cf1ff
File content as of revision 0:341db01762fe:
#include "mbed.h"
// assign I2C pins
int I2C_adr = 0x27 << 1;
// initialise
char C39_data[3] = {0, 255, 255};
int instWeight = 0;
//Set up serial and I2C connections
Serial pc(USBTX, USBRX);
I2C i2c(p9, p10);
int main() {
while(1){
i2c.read(I2C_adr, C39_data, 3);
if (C39_data[1] < 255) {
instWeight = C39_data[1] << 8;
instWeight = instWeight | C39_data[2];
pc.printf("%d\n",instWeight);
}
}
}