Control arduino via lcd
First we need to get the address of the component in the STONE display that shows the heart rate and oximetry data.
In my project, the address is as follows.
open component address: 0020
close component address: 0020
The modified code would be as follows:
uint8_t buff[9]={0};
void setup()
{
Serial.begin(115200); //设定的波特率
pinMode(LED_BUILTIN,OUTPUT);
}void loop()
{
while (Serial.available() > 0)
{
for(uint8_t i=0;i<9;i++)
{
buff =uint8_t(Serial.read());
Serial.write(buff);
delay(2);
}
//digitalWrite(LED_BUILTIN,HIGH);
}
if(buff[8]==1)
{
digitalWrite(LED_BUILTIN,HIGH);
}
else if(buff[8]==2)
{
digitalWrite(LED_BUILTIN,LOW);}
}