audio test
parent
6bb8b9e5a0
commit
360100e22b
|
|
@ -267,7 +267,7 @@
|
||||||
{ "id": "stetho",
|
{ "id": "stetho",
|
||||||
"name": "Stethoscope",
|
"name": "Stethoscope",
|
||||||
"icon": "stetho.png",
|
"icon": "stetho.png",
|
||||||
"version":"0.016",
|
"version":"0.017",
|
||||||
"description": "Hear your heart rate",
|
"description": "Hear your heart rate",
|
||||||
"tags": "health",
|
"tags": "health",
|
||||||
"storage": [
|
"storage": [
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,13 @@ var wasHigh = 0, wasLow = 0;
|
||||||
var lastHigh = getTime();
|
var lastHigh = getTime();
|
||||||
var hrmList = [];
|
var hrmList = [];
|
||||||
var hrm;
|
var hrm;
|
||||||
|
|
||||||
var SPEAKER_PIN = D18;
|
var SPEAKER_PIN = D18;
|
||||||
|
|
||||||
function freq(f) {
|
function freq(f) {
|
||||||
|
console.log("frequency : ", f);
|
||||||
if (f===0) digitalWrite(SPEAKER_PIN, 0);
|
if (f===0) digitalWrite(SPEAKER_PIN, 0);
|
||||||
else analogWrite(SPEAKER_PIN, 0.5, {freq: f});
|
else analogWrite(SPEAKER_PIN, 0.5, {freq: f});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function readHRM() {
|
function readHRM() {
|
||||||
var a = analogRead(D29);
|
var a = analogRead(D29);
|
||||||
|
|
@ -26,11 +25,10 @@ function readHRM() {
|
||||||
g.clearRect(0,100,239,239);
|
g.clearRect(0,100,239,239);
|
||||||
g.moveTo(-100,0);
|
g.moveTo(-100,0);
|
||||||
}
|
}
|
||||||
|
freq(parseFloat(a*960*4));
|
||||||
|
|
||||||
g.setColor(1,1,1);
|
g.setColor(1,1,1);
|
||||||
g.lineTo(x,y);
|
g.lineTo(x,y);
|
||||||
freq((parseFloat(y) * 1000.0) + 500.0);
|
|
||||||
console.log("frequency " + ((parseFloat(y) * 1000.0) + 500.0));
|
|
||||||
|
|
||||||
if ((max-min)>0.005) {
|
if ((max-min)>0.005) {
|
||||||
if (4*a > (min+3*max)) { // high
|
if (4*a > (min+3*max)) { // high
|
||||||
g.setColor(1,0,0);
|
g.setColor(1,0,0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue