Stéf PEREZ / Mbed 2 deprecated Dump_i2c_test

Dependencies:   mbed FastPWM

Committer:
stefkpl
Date:
Fri Oct 14 08:42:47 2016 +0000
Revision:
0:392956e976ae
Child:
1:3a2023b0563c
Initial Commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
stefkpl 0:392956e976ae 1 #include "mbed.h"
stefkpl 0:392956e976ae 2 // Test DUMP I2C
stefkpl 0:392956e976ae 3 #define _ADDR (0x43)
stefkpl 0:392956e976ae 4
stefkpl 0:392956e976ae 5 I2C i2c(I2C_SDA, I2C_SCL);
stefkpl 0:392956e976ae 6
stefkpl 0:392956e976ae 7 DigitalOut myled(LED1);
stefkpl 0:392956e976ae 8
stefkpl 0:392956e976ae 9 Serial pc(SERIAL_TX, SERIAL_RX);
stefkpl 0:392956e976ae 10
stefkpl 0:392956e976ae 11 int main()
stefkpl 0:392956e976ae 12 {
stefkpl 0:392956e976ae 13 int status = i2c.write(_ADDR);
stefkpl 0:392956e976ae 14 pc.printf("Begin Scan\r\n");
stefkpl 0:392956e976ae 15
stefkpl 0:392956e976ae 16 // Read all register
stefkpl 0:392956e976ae 17 data_write[0] = LM75_REG_TEMP;
stefkpl 0:392956e976ae 18 i2c.write(LM75_ADDR, data_write, 1, 1); // no stop
stefkpl 0:392956e976ae 19 i2c.read(LM75_ADDR, data_read, 2, 0);
stefkpl 0:392956e976ae 20
stefkpl 0:392956e976ae 21 while (1) {
stefkpl 0:392956e976ae 22 myled = !myled;
stefkpl 0:392956e976ae 23 wait(0.2);
stefkpl 0:392956e976ae 24
stefkpl 0:392956e976ae 25 }
stefkpl 0:392956e976ae 26