hello!
can you tell me the address of this sensor ???
below is the code of reference on mbed, but it doesn’t react at 0xA0…
what’s the problem??
#include “mbed.h”
I2C i2c(I2C_SDA, I2C_SCL);
const int addr = 0xA0;
int main() {
char heart_rate;
while (1) {
i2c.read(addr, &heart_rate, 1);
printf(“heart rate: = %d\r\n”, heart_rate);
}
}
kavi
#2
Hello,
Please use the following code
[code]#include “mbed.h”
#include “USBSerial.h”
USBSerial serial;
I2C i2c(P0_5, P0_4); //instead of P0_5, P0_4 specify the port pin number of the sda,scl of your board
const int addr = 0xA0;
int main() {
char data;
while (1) {
i2c.read(addr, &data, 1);
serial.printf(“heart rate: = %d\n”, data);
wait(.5);
}
}[/code]
and let us know if you have any other issues.
Thanks and Regards