This is the code for the project which is based on arduino in which i am getting systolic and diasystolic pressure from EEprom and these are the values of getting . After that as you can see, i am then transferring that data to esp32 using serial.write() .
#include <Wire.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(8, 7);
uint32_t current_millis;
uint32_t prev_millis;
volatile byte XEEPROM[256] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0xb0, 0xc4, 0x54, 0xf0, 0x69, 0xca, 0xb3, 0x28, 0x84, 0xa5, 0xc1, 0x80, 0x53, 0x69, 0x0c, 0x38, 0x4f, 0x0c, 0x74, 0xa1, 0x5b, 0x8c, 0x71, 0x34, 0x30, 0x38, 0x30, 0x30, 0x38, 0x31, 0x35, 0x33, 0x31, 0x30, 0x35, 0x00, 0x12, 0x5a, 0x1e, 0xbd, 0x9e, 0x00, 0x00, 0x02, 0x82, 0x30, 0xaa, 0x10, 0xb7, 0x7f, 0x8d, 0x0a, 0xcb, 0x2e, 0xc1, 0xeb, 0x52, 0x20, 0xdc, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0x55, 0x57, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x47, 0x4d, 0x54, 0x00, 0x42, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x05, 0x00, 0x02, 0x03, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc4, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x68, 0xaa, 0xdd, 0x02, 0x46, 0x45, 0x8f, 0x8f, 0x78, 0x56, 0xbb, 0x69, 0x01, 0x04, 0x46, 0x45, 0x8f, 0x8f, 0x78, 0x56, 0xbb, 0x69, 0x01, 0x04, 0x46, 0x45, 0x8f, 0x8f, 0x78, 0x56, 0xbb, 0x69, 0x12, 0x03, 0x46, 0x45, 0x8f, 0x8f, 0x78, 0x56, 0xbb, 0x69, 0x02, 0x02, 0x46, 0x45, 0x8f, 0x8f, 0x78, 0x56, 0xbb, 0x69, 0x12, 0x02, 0x84, 0x79, 0x80, 0x00, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00, 0x00 };
volatile byte rQ, rD;
volatile int data_count;
volatile int wrote;
volatile uint16_t count;
volatile uint8_t sys, dia, hr;
void setup()
{
Serial.begin(115200);
mySerial.begin(115200);
Wire.begin(0x50);
Wire.onReceive(receiveEvent);
// Wire.onRequest(requestEvent);
uint16_t counter = 0;
while (counter <= 256)
{
XEEPROM[counter] = 0x00;
counter++;
}
}
void loop()
{
// mySerial.println("1234");
current_millis = millis();
if (current_millis - prev_millis > 5000)
{
prev_millis = current_millis;
if (count == 0)
{
Serial.print(":");
// Serial.print(data_count);
// Serial.print(" count--->");
// Serial.println(count);
}
else if (count == 35)
{
Serial.print("Blood Presure Data: ");
Serial.print(sys);
Serial.print("/");
Serial.println(dia);
Serial.println("");
}
else
{
// Serial.println("error");
}
count = 0;
}
}
void receiveEvent(int iData)
{
data_count = iData;
if ( iData > 0 )
{
while ( iData-- )
{
rQ = Wire.read();
//Serial.println(rQ);
count++;
if (count == 10)
{
sys = rQ;
Serial.println(sys);
mySerial.write(sys);
}
if (count == 14)
{
dia = rQ;
Serial.println(dia);
mySerial.write(dia);
}
if (count == 16)
{
hr = rQ;
}
}
}
}