에듀이노-코딩교육 전문 쇼핑몰 에듀이노-코딩교육 전문 쇼핑몰

학교, 공공기관이라면 후불결제하세요!

 
현재 위치
  1. 게시판
  2. 묻고답하기

묻고답하기

상품 게시판 상세
제목 Bpm에따라 led에 불들어오게하고싶은데 소스의어디부분을 수정해야할까요
작성자 이준서 (ip:)
  • 작성일 2019-06-16
  • 추천 추천하기
  • 조회수 102
* Pulse Sensor Amped 1.5 by Joel Murphy and Yury Gitman http://www.pulsesensor.com

---------------------- Notes ---------------------- ----------------------
This code:
1) Blinks an LED to User's Live Heartbeat PIN 13
2) Fades an LED to User's Live HeartBeat PIN 5
3) Determines BPM
4) Prints All of the Above to Serial

Read Me:
https://github.com/WorldFamousElectronics/PulseSensor_Amped_Arduino/blob/master/README.md
---------------------- ---------------------- ----------------------
*/

#define PROCESSING_VISUALIZER 1
#define SERIAL_PLOTTER 2

// Variables
int pulsePin = 0; // Pulse Sensor purple wire connected to analog pin 0
int blinkPin = 13; // pin to blink led at each beat
int fadePin = 5; // pin to do fancy classy fading blink at each beat
int fadeRate = 0; // used to fade LED on with PWM on fadePin

// Volatile Variables, used in the interrupt service routine!
volatile int BPM; // int that holds raw Analog in 0. updated every 2mS
volatile int Signal; // holds the incoming raw data
volatile int IBI = 600; // int that holds the time interval between beats! Must be seeded!
volatile boolean Pulse = false; // "True" when User's live heartbeat is detected. "False" when not a "live beat".
volatile boolean QS = false; // becomes true when Arduoino finds a beat.

// SET THE SERIAL OUTPUT TYPE TO YOUR NEEDS
// PROCESSING_VISUALIZER works with Pulse Sensor Processing Visualizer
// https://github.com/WorldFamousElectronics/PulseSensor_Amped_Processing_Visualizer
// SERIAL_PLOTTER outputs sensor data for viewing with the Arduino Serial Plotter
// run the Serial Plotter at 115200 baud: Tools/Serial Plotter or Command+L
static int outputType = SERIAL_PLOTTER;


void setup(){
pinMode(blinkPin,OUTPUT); // pin that will blink to your heartbeat!
pinMode(fadePin,OUTPUT); // pin that will fade to your heartbeat!
Serial.begin(115200); // we agree to talk fast!
interruptSetup(); // sets up to read Pulse Sensor signal every 2mS
// IF YOU ARE POWERING The Pulse Sensor AT VOLTAGE LESS THAN THE BOARD VOLTAGE,
// UN-COMMENT THE NEXT LINE AND APPLY THAT VOLTAGE TO THE A-REF PIN
// analogReference(EXTERNAL);
}


// Where the Magic Happens
void loop(){

serialOutput() ;

if (QS == true){ // A Heartbeat Was Found
// BPM and IBI have been Determined
// Quantified Self "QS" true when arduino finds a heartbeat
fadeRate = 255; // Makes the LED Fade Effect Happen
// Set 'fadeRate' Variable to 255 to fade LED with pulse
serialOutputWhenBeatHappens(); // A Beat Happened, Output that to serial.
QS = false; // reset the Quantified Self flag for next time
}

ledFadeToBeat(); // Makes the LED Fade Effect Happen
delay(20); // take a break
}





void ledFadeToBeat(){
fadeRate -= 15; // set LED fade value
fadeRate = constrain(fadeRate,0,255); // keep LED fade value from going into negative numbers!
analogWrite(fadePin,fadeRate); // fade LED
}



이건데요 bpm80이상일때 불이들어오게 하고싶은데 어떻게 수정해야할까요
평점 0점
첨부파일
비밀번호 삭제하려면 비밀번호를 입력하세요.
댓글 수정

비밀번호 :

수정 취소

/ byte

비밀번호 : 확인 취소

댓글 입력

댓글달기이름 :비밀번호 : 관리자답변보기

확인

/ byte

왼쪽의 문자를 공백없이 입력하세요.(대소문자구분)

에게만 댓글 작성 권한이 있습니다.

댓글 입력

댓글달기이름 :비밀번호 :

확인

/ byte

왼쪽의 문자를 공백없이 입력하세요.(대소문자구분)

에게만 댓글 작성 권한이 있습니다.

관련 글 보기

관련글 모음
no item title name date hit
13957 아두이노 심장박동 측정 센서 모듈 Arduino Pulse Sensor 재입고는 언제인가요?? ybjunna1 2019-09-25 27
13962    답변 재입고는 언제인가요?? 에듀이노3 2019-09-25 24
12761 아두이노 심장박동 측정 센서 모듈 Arduino Pulse Sensor 작동시켜봤는데 bpm값이 200이 넘습니다. 파일첨부 sijune0525 2019-06-24 43
12774    답변 작동시켜봤는데 bpm값이 200이 넘습니다. CS / 배송 2019-06-25 40
12641 아두이노 심장박동 측정 센서 모듈 Arduino Pulse Sensor Bpm에따라 led에 불들어오게하고싶은데 소스의어디부분을 수정해야할까요 HIT 이준서 2019-06-16 102
«
»