Question: Below is a code that is written to get pixels to blink to my heartbeat. Currently it beats green to my heart beat. How would

Below is a code that is written to get pixels to blink to my heartbeat. Currently it beats green to my heart beat. How would I get this code to blink green for heartrates 0-90 and blink red for heartbeats 90-200? Using Arduino IDE, Adafruit Flora, and this link to help (https://learn.adafruit.com/heart-rate-badge/program-it)

/* Heart Rate Badge with heart-shaped neopixel display written by Becky Stern for Adafruit Industries Based on sample code from http://learn.parallax.com/KickStart/28048 */ #include // Parameter 1 = number of pixels in strip // Parameter 2 = pin number (most are valid) // Parameter 3 = pixel type flags, add together as needed: // NEO_RGB Pixels are wired for RGB bitstream // NEO_GRB Pixels are wired for GRB bitstream // NEO_KHZ400 400 KHz bitstream (e.g. FLORA pixels) // NEO_KHZ800 800 KHz bitstream (e.g. High Density LED strip) Adafruit_NeoPixel strip = Adafruit_NeoPixel(2, 12, NEO_GRB + NEO_KHZ800); //Definitions const int HR_RX = 2; byte oldSample, sample; void setup() { strip.begin(); strip.show(); // Initialize all pixels to 'off' colorWipe(strip.Color(20, 0, 0), 50); // Red Serial.begin(9600); pinMode (HR_RX, INPUT); //Signal pin to input Serial.println("Waiting for heart beat..."); // Wait until a heart beat is detected while (!digitalRead(HR_RX)) {}; Serial.println ("Heart beat detected!"); } void loop() { sample = digitalRead(HR_RX); //Store signal output if (sample && (oldSample != sample)) { Serial.println("Beat"); heartBeat(); } oldSample = sample; //Store last signal received for (volatile int i=0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!