i2c

Dependencies:   mbed

main.cpp

Committer:
qaz
Date:
2020-07-18
Revision:
0:cbf763d04f7a

File content as of revision 0:cbf763d04f7a:

#include "mbed.h"

I2C i2c(PTE0, PTE1);

char read_sensor_lower_8bit( void )
{
    char    v;
    char    cmd;
 
    cmd    = 0xA0;
 
    i2c.write( 0xD0, &cmd, 1 );
    i2c.read( 0xD0, &v, 1 );
 
    return( v );
}

int main() {
    printf("Got this: %d", read_sensor_lower_8bit());
}