Seeed
Published © MIT

Seeeduino XIAO Expansion Board - Heart Rate

The Seeeduino XIAO can be a more comfortable device of measuring heart rate.

BeginnerFull instructions provided1 hour2,598

Things used in this project

Hardware components

Seeed Studio Seeeduino XIAO
×1
Seeed Studio Seeeduino XIAO expansion board
×1
Seeed Studio Grove - Finger-clip Heart Rate Sensor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Seeeduino XIAO expansion board - Heart rate

C/C++
This is Heart rate code for Seeeduino XIAO
#include <Arduino.h>
#include <U8x8lib.h>

#include <Wire.h>

U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE);

void setup() {
  Serial.begin(9600);
  Serial.println("heart rate sensor:");

  u8x8.begin();
  u8x8.setFlipMode(1);
  Wire.begin();
}
void loop() {
  Wire.requestFrom(0xA0 >> 1, 1);    // request 1 bytes from slave device
  while (Wire.available()) {         // slave may send less than requested
    unsigned char c = Wire.read();   // receive heart rate value (a byte)
    u8x8.setFont(u8x8_font_chroma48medium8_r);
//    u8x8.setCursor(0, 3);
//    u8x8.print("blood detecting ");
//    delay(10000);

    u8x8.setCursor(0, 3);
    u8x8.print("HeartRate: ");
    u8x8.setCursor(10, 3);
    u8x8.print(c);
    u8x8.setCursor(13, 3);
    u8x8.print("bpm");
    Serial.println(c);

  }
  delay(500);
}

Credits

Seeed

Seeed

102 projects • 168 followers
Seeed R&D Team

Comments