Heart Rate Counter

A counter which can help to make training with proper heart rates. Sources for rates are:

https://www.topendsports.com/testing/heart-rate-max.htm
https://www.topendsports.com/fitness/karvonen-formula.htm
https://www.topendsports.com/fitness/heartrate-range.htm
https://www.topendsports.com/testing/heart-rate.htm
https://vocatum.fi/sykealueet-liikunta/

Heart_rate_counter_deb-package_and_script.zip

Code:

#!/bin/bash
#
# RJP 5.3.2025
# Heart rate counter for exercise. It gives approximal rates for training.
# Suorces:
# https://www.topendsports.com/testing/heart-rate-max.htm
# https://www.topendsports.com/fitness/karvonen-formula.htm
# https://www.topendsports.com/fitness/heartrate-range.htm
# https://www.topendsports.com/testing/heart-rate.htm
# https://vocatum.fi/sykealueet-liikunta/
#
#
AGE=`yad --center --width=100 --height=100 --text-align=center --title=$"Heart Rate Counter" --text="PUT YOUR AGE TO THE" --entry --entry-label=BOX --entry-text=""`
#
if [[ $AGE -lt 10 ]] || [[ $AGE -gt 80 ]]
then
yad --width=300 --text-align=center --center --title=$"Your results are:" --text="
You are too young or old for the test "
else
awk "BEGIN {print (220 - ($AGE))}" > /tmp/tulos0.txt
awk -v FS='.' '{print $1}' /tmp/tulos0.txt > /tmp/tulos.txt
#
sleep 0,1
awk "BEGIN {print ($(cat /tmp/tulos.txt) * (80 / 100))}" > /tmp/aaero0.txt
awk -v FS='.' '{print $1}' /tmp/aaero0.txt > /tmp/aaero.txt
#
sleep 0,1
awk "BEGIN {print ($(cat /tmp/tulos.txt) * (65 / 100))}" > /tmp/basic0.txt
awk -v FS='.' '{print $1}' /tmp/basic0.txt > /tmp/basic.txt
#
sleep 0,1
awk "BEGIN {print ($(cat /tmp/tulos.txt) * (55 / 100))}" > /tmp/rest0.txt
awk -v FS='.' '{print $1}' /tmp/rest0.txt > /tmp/rest.txt
# The results
yad --width=400 --text-align=center --center --title=$"Your results are:" --text="YOUR HEART RATEs ARE

Your maximum heart rate is $(cat /tmp/tulos.txt)

Your anaerobic rate is $(cat /tmp/aaero.txt)

Your basic training rate is $(cat /tmp/basic.txt)

Your light training rate is $(cat /tmp/rest.txt)”
fi

Run as a program

 

For example for 11 years

The results

If you are under 10 or over 80 years