-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
61 lines (51 loc) · 1.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!File: oximeterHTML.html>
<!Author: Joseph Oduor>
<!Date: 12/06/2021>
<!Brief: Pulse oximeter website>
<html>
<head>
<!Icon for the webpage>
<link rel="shortcut icon" href="..\Oximeter HTML\rateicon.png" type="image/x-icon" />
<title>Pulse Oximeter</title>
</head>
<body>
<script type="text/JavaScript">
//Get a value from a URL
function httpGet(theUrl)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
xmlHttp.send( null );
var sec = xmlHttp.responseText;
//exclude opening and closing quotations
if (sec [3]=='"')
var stringValue=sec[2];
else if (sec [4]=='"')
var stringValue=sec[2]+sec[3]
else if(sec[5]=='"')
var stringValue=sec[2]+sec[3]+sec[5]
var value=parseInt(stringValue)
return value;
}
// the timer reference
let timer;
// Don't need a for loop in setInterval, the function itself is aleady called in iterations.
function type()
{
var dt=new Date();
var myTime=dt.toLocaleTimeString();
var BPM =httpGet("https://blynk-cloud.com/eD64Lmt1VkBY__DdWGA0svSxzvSaFFji/get/V1").toString();
var SPO2=httpGet("https://blynk-cloud.com/eD64Lmt1VkBY__DdWGA0svSxzvSaFFji/get/V2").toString();
// print time and oximeter readings in table format
htmlString='<table style="width:50%"><tr><td>'+myTime;
htmlString+='</td><td>'+BPM+' beats per minute</td><td>';
htmlString+=SPO2+'% SpO2</td></tr></table>';
//Don't print zero values for when finger is out
if (parseInt(BPM)!=0 && parseInt(SPO2)!=0)
document.write(htmlString);
}
// pass in function, instead of calling it
timer = setInterval(type, 1000);
</script>
</body>
</html>