Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #51463
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Paul Rubin <no.email@nospam.invalid> |
| Newsgroups | comp.lang.forth |
| Subject | take your pulse |
| Date | Thu, 29 Sep 2016 15:28:12 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 29 |
| Message-ID | <87h98y49z7.fsf@jester.gateway.pace.com> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Info | mx02.eternal-september.org; posting-host="590ea01354cf4bcbcd857d7ebbd88128"; logging-data="22265"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/UYVLQNEr9VgTm83j76SGh" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
| Cancel-Lock | sha1:iLqgwZdPp+bwgGytEhsWAgrrEDY= sha1:bxwGzG7iKFPAfiiOCODbXK8UvqU= |
| Xref | csiph.com comp.lang.forth:51463 |
Show key headers only | View raw
Just wrote this to take my pulse before and after exercising. Not
impressive at all, but hey, it's an actual Forth application and we
don't get many of those here ;-).
Usage:
1. run the program
2. put your finger on your pulse (wrist or whatever)
3. hit a key to start timing (space bar works)
4. Count pulse beats for a while (I've been counting to 20)
5. hit a key to stop timing
6. Enter number of beats you counted. Pulse in bpm is shown.
There's no error checking. It's probably a monstrous security
vulnerability to connect this program to an open internet port, so
don't do that ;-). Tested with gforth but should port easily
given a utime primitive (measure time in microseconds).
================================================================
#! /usr/bin/gforth
: interval ( -- f ) \ measure interval in seconds
." hit a key to start" cr key drop utime
." hit a key to stop" cr key drop utime
2swap d- d>f 1e-6 f* ;
: readnum ( -- f ) pad 80 accept >r 0 0 pad r> >number 2drop d>f ;
: get-count ( -- f ) ." enter pulse count: " readnum ;
: go interval fdup f. ." sec " cr
get-count 60e f* fswap f/ f. ." bpm" cr ;
go bye
================================================================
Back to comp.lang.forth | Previous | Next — Next in thread | Find similar | Unroll thread
take your pulse Paul Rubin <no.email@nospam.invalid> - 2016-09-29 15:28 -0700
Re: take your pulse Lars Brinkhoff <lars.spam@nocrew.org> - 2016-09-30 07:44 +0200
Re: take your pulse Paul Rubin <no.email@nospam.invalid> - 2016-09-29 22:52 -0700
Re: take your pulse Ilya Tarasov <ilya74.tarasov@gmail.com> - 2016-09-30 04:42 -0700
Re: take your pulse Paul Rubin <no.email@nospam.invalid> - 2016-09-30 12:31 -0700
Re: take your pulse Ilya Tarasov <ilya74.tarasov@gmail.com> - 2016-09-30 14:12 -0700
Re: take your pulse Ilya Tarasov <ilya74.tarasov@gmail.com> - 2016-09-30 15:17 -0700
Re: take your pulse Paul Rubin <no.email@nospam.invalid> - 2016-09-30 16:27 -0700
Re: take your pulse Ilya Tarasov <ilya74.tarasov@gmail.com> - 2016-10-02 16:58 -0700
Re: take your pulse hughaguilar96@gmail.com - 2016-09-30 19:35 -0700
Re: take your pulse Julian Fondren <julian.fondren@gmail.com> - 2016-09-30 20:11 -0700
csiph-web