Assignment 3: Output and Sensor

My concept is a digital mood ring that senses your heartbeat and displays either red, blue or green to show your mood/feelings through your heartbeat.

I used the Sensor pulse heart rate monitor and found their basic heartbeat code that uses the internal pin 13 led on the arduino board.  I added the RGB 3-pin LED light and started playing with the threshold number based on the serial plotter tool in the Arduino application.  The threshold determines what a heartbeat is- anything below or above a certain number is considered a heartbeat.  I got the led bulb to flash over a certain threshold, but I had a hard time mapping out what is considered a heart beat or not.  Because I had a hard time programming what constitutes a heartbeat in the code, I wasn’t able to map it to the RGB colors.  The video shows the heartbeat sensor responding and lighting up to one color- red.

Here is the code:

int LED = 13;

int Signal;
int Threshold = 620;

void setup() {
pinMode(LED13,OUTPUT);
Serial.begin(115200);
}

void loop() {

 

Serial.println(Signal);

if(Signal > Threshold){
digitalWrite(LED13,HIGH);
} else {
digitalWrite(LED13,LOW);

 

delay(15);

}

 

 

 

Leave a reply:

Your email address will not be published.

Site Footer