Steven Kay
/
MCP9803_NUCLEO_Driver
Initial I2C Working
Diff: main.cpp
- Revision:
- 0:fbf82bf637bb
- Child:
- 1:444546e8cd20
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Mar 29 08:33:10 2017 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "MCP9803.h" + +MCP9803 TempSensor(PB_9,PB_8,0x90,100000); + +int main() +{ + char data[2]; + + data[0] = 0x01; + data[1] = 0x72; + + printf("Write Return Value = %d\r\n",TempSensor.I2C_Write(data,2)); + + data[0] = 0x01; + + printf("Write Return Value = %d\r\n",TempSensor.I2C_Write(data,1)); + + TempSensor.I2C_Read(1); + + data[0] = 0x00; + TempSensor.I2C_Write(data,1); + + TempSensor.I2C_Read(2); + + + +} \ No newline at end of file