Sure...
Main:
· DEBUG· "Honey, I love you ... can I spend $100?· Please..."
· END
As far as the rest of your program, calculating BPM from your 120 Hz input is easy:
· bpm =·7200 / countHz
Displaying on three 7-segment LEDs will take a bit of hardware, and you have choices: you could use a multiplexer like the MAX7219 or the MC14489 (cheaper), or -- if the display cathodes are not common -- you can go really cheap and use a 74HC595 for each digit.· These can be daisy-chained so you'll only need three IO pins to display the BPM (that goes for the muliplexers as well).
Calculating the blink rate for the LEDs is no big mystery either.· Assuming a 50% duty-cycle you could do this:
· blinkRate = 30000 / bpm
· DO
··· TOGGLE BpmLed
··· PAUSE blinkRate
· LOOP UNTIL (StartBtn = Pressed)
See my attachment for a more advanced version that turns the LED on for a fixed period; the off time is dependent on the bpm value.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax



Reply With Quote




Bookmarks