Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #51463

take your pulse

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.forth
Subject take your pulse
Date 2016-09-29 15:28 -0700
Organization A noiseless patient Spider
Message-ID <87h98y49z7.fsf@jester.gateway.pace.com> (permalink)

Show all headers | 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


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