keniti akiba
/
AQM0802A_010_test1
test
Revision 0:dcf8d1f0aeee, committed 2021-02-06
- Comitter:
- caa45040
- Date:
- Sat Feb 06 10:13:50 2021 +0000
- Commit message:
- stm32l010f4p6 i2c
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r dcf8d1f0aeee main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Feb 06 10:13:50 2021 +0000 @@ -0,0 +1,69 @@ +#include "mbed.h" + +#define ADDR (0x7C) // address + +//I2C i2c(I2C_SDA, I2C_SCL); +I2C i2c(PA_10, PA_9); + +//DigitalOut myled(LED1); + +//Serial pc(SERIAL_TX, SERIAL_RX); + +//volatile char TempCelsiusDisplay[] = "+abc.d C"; + +int main() +{ + + char data_read[2]; + + //init + wait(0.2); + + data_read[0] = 0x0; + + data_read[1]=0x38; + i2c.write(ADDR, data_read, 2); + + data_read[1]=0x39; + i2c.write(ADDR, data_read, 2); + + data_read[1]=0x14; + i2c.write(ADDR, data_read, 2); + + data_read[1]=0x70; + i2c.write(ADDR, data_read, 2); + + data_read[1]=0x56; + i2c.write(ADDR, data_read, 2); + + data_read[1]=0x6C; + i2c.write(ADDR, data_read, 2); + + wait(0.2); + + data_read[1]=0x38; + i2c.write(ADDR, data_read, 2); + + data_read[1]=0x0C; + i2c.write(ADDR, data_read, 2); + + data_read[1]=0x01; + i2c.write(ADDR, data_read, 2); + + wait(0.2); + + data_read[0]='@'; + data_read[1]='a'; + i2c.write(ADDR, data_read, 2); + + + while (1) { + + // Display result +// pc.printf("temp = %s\n", TempCelsiusDisplay); +// myled = !myled; + wait(2.0); + + } + +}
diff -r 000000000000 -r dcf8d1f0aeee mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Feb 06 10:13:50 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/2e9cc70d1897 \ No newline at end of file