아두이노 컴파일 오류가 뜨네요ㅠㅠㅠㅠㅠ
#define USE_ARDUINO_INTERRUPTS true
#include <PulseSensorPlayground.h>
#define button 2
#define buzzer 8
#include "pitches.h"
const int PulseWire = 0;
int Threshold = 550;
PulseSensorPlayground pulseSensor;
#include <HuemonelabKit.h>
RGBLed rgb(11,12,13);
int dustPin = A0;
int ledPower = 10;
int samplingTime = 280;
int deltaTime = 40;
int sleepTime = 9680;
float voMeasured = 0;
float calcVoltage = 0;
float dustDensity = 0;
int bt=4;
void setup(){
Serial.begin(9600);
pinMode(ledPower,OUTPUT);
pinMode(buzzer,OUTPUT);
pinMode(button,INPUT);
pinMode(bt,INPUT);
attachInterrupt(0,blink,RISING);
Serial.begin(9600);
pulseSensor.analogInput(PulseWire);
pulseSensor.setThreshold(Threshold);
if(pulseSensor.begin()){
Serial.println("We created a pulseSensor Object ! ");
}
}
void loop(){
int myBPM = pulseSensor.getBeatsPerMinute();
if(pulseSensor.sawStartOfBeat()){
Serial.println("♥ A HeartBeat Happened ! ");
Serial.print("BPM: ");
Serial.println(myBPM);
}
if(pulseSensor.sawStartOfBeat()==0){
delay(30000);
tone(8,NOTE_G4,10000);
}
if (digitalRead(bt==HIGH)){
digitalWrite(ledPower,LOW);
delayMicroseconds(samplingTime);
voMeasured = analogRead(dustPin);
delayMicroseconds(deltaTime);
digitalWrite(ledPower,HIGH);
delayMicroseconds(sleepTime);
calcVoltage = voMeasured*(5.0/1024.0);
dustDensity = (0.17*calcVoltage-0.1)*1000;
if (digitalRead(bt==HIGH)){
Serial.println(dustDensity);
delay(2000);
if ( dustDensity > 150 ) {
rgb.setColor(255,0,0);
}
else if ( dustDensity > 80) {
rgb.setColor(255,255,0);
}
else if ( dustDensity > 30) {
rgb.setColor(0,255,0);
}
else {
rgb.setColor(0,0,255);
}
delay(10000);
rgb.setColor(0,0,0);
}
}
}
void blink(){
noTone(buzzer);
delay(1000000000);
}
|