Initial I2C Working

Dependencies:   mbed

main.cpp

Committer:
sk398
Date:
2017-03-29
Revision:
0:fbf82bf637bb
Child:
1:444546e8cd20

File content as of revision 0:fbf82bf637bb:

#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);
    
    
    
}