2016年10月7日 星期五

[IoT] Pulse Sensor

購買頁面:[產品] 脈搏感測器模組(Pulse Sensor)

1. Pulse Sensor 環境設定:
arduino 1.5.8 + github

2. Pulse Sensor 修改(Arduino)
1.) static boolean serialVisual = true; // Set to 'false' by Default. Re-set to 'true' to see Arduino Serial Monitor ASCII Visual Pulse
2). delay(2000); // take a break

3. Arduino 藍牙設定, 需配合 pulse sensor 將 BT 的 UART 改為 115200

設定程式碼
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
 
void setup()
{
  pinMode(9, OUTPUT);
  digitalWrite(9, HIGH);
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
 
  Serial.println("Ready!");
  // for HC-05 use 38400 when poerwing with KEY/STATE set to HIGH on power on
  mySerial.begin(9600);
}
 
void loop() // run over and over
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}

沒有留言: