Hi,
I'm trying to get a reading from blood pressure machine that uses FT24C16A EEPROM. I've connected all the necessary pins from the FT24C16A to Arduino UNO and successfully got a reading from the I2C interface, but the data that came out doesn't match the reading on the machine.
Here is the code I'm using:
#include <Wire.h>
int sys,dias,bpm;
bool bPrint=0;
int count,countT;
char buff[30];
void setup()
{
Wire.begin(0x50); // join i2c bus with address #4
Wire.onReceive(receiveEvent); // register event
Serial.begin(9600); // start serial for output
}
void loop()
{
}
void receiveEvent(int howMany)
{
while(0 < Wire.available()) // loop through all but the last
{
char c=Wire.read(); // receive byte as a character
int ic=c;
Serial.println(ic);
if(countT<4) {
if(c=='A'){
countT=1;
}
if(c=='9') {
countT++;
}
if(c=='1') {
countT++;
}
if(c=='0') {
countT++;
}
} else if (countT==4) {
//Serial.write(c);
if (count==0) {
sys=c;
} else if (count==1) {
dias=c;
} else {
bpm=c;
}
count++;
if (count==3) {
Serial.println("");
sprintf(buff,"sys:%d, dias:%d, bpm:%d",sys,dias,bpm);
Serial.println(buff);
countT=0;
count=0;
}
}
}
}