- This topic has 15 replies, 2 voices, and was last updated 10 years, 8 months ago by Uplink1001.
-
AuthorPosts
-
Uplink1001MemberHELPHi,
Still need a bit of help with the example stopwatch.
I have edited the code to remove the milli secs as not needed.
Also altered so that the seconds count 100 every minute, the hrs and mins stay the same.
What I need is for the seconds to display on the right of the screen and the hours and mins to show on the left how to do this?
Also need the 100 count to beep on every count eg 1 beep 2 beep ect::
Sorry cant post the edited code, for some reason can’t post from my pc(error 400)..?
The code edited was from the following link.
Any help would be fantasiic…….http://www.genuitec.com/support-genuitec/viewtopic.php?f=14&t=6915
Uplink1001
BrandonMemberIm not on my dev systems, but you can use this, then set the variables to any text field you need, they dont have to be togehter.
function startTime() { var today=new Date(); var h=today.getHours(); var m=today.getMinutes(); var s=today.getSeconds(); // add a zero in front of numbers<10 m=checkTime(m); s=checkTime(s); t=setTimeout(function(){startTime()},100); } function checkTime(i) { if (i<10) { i="0" + i; } return i; }
Uplink1001MemberThanks for that
Just another question.
How do I get the timer to beep one every time on the 100 count down
As before 1 then beep and so on?
Uplink 1001
BrandonMemberYou can use this where ever you want it to beep:
navigator.notification.beep(1);So if you have the counter that counts to 100, when it gets there use the above to beep.
Or, you can use a new timer that is 1000, though I would try to keep it in the same code so it stays synced with the counter.
Uplink1001MemberHi.
Still need a little help with the code for the stopwatch, see code and attaced pic.
Problem: need the counter to beep on every count upto 100 eg: 1 beep 2 beep 3 beep and so on up to 100
then counter restarts and need it to do the same again? where do i add the beep function in the code?
Sorry still cant post as Code ( getting error code 404 when trying to post any code on the forum chrome crashes out.)? , so have added the file itself>Thanks
Uplink1001Attachments:
You must be logged in to view attached files.
Uplink1001MemberAnyone have any idea where to put the code to get this darn thing to beep after every count 1beep 2beep 3beep and so on????
Uplink1001
BrandonMemberTry this:
function update() {
$(‘#m1-CPRstopwatch-text1’).text(formatTime(x.time()));
if($(‘#m1-CPRstopwatch-text1′).text() == ’99’){navigator.notification.beep(1);} /// NEW LINE
}
Uplink1001MemberHi.
Thanks for that CincyPlanet
I will give it a try tomorrow, and get back with the result
At work at the moment.
Thanks againUplink1001
Uplink1001MemberHi. CincyPlanet
Still stuck…
Can you have a look at the attachment file i posted earlier with the demo of the clock?
and maybe tell me where i am going wrong.
Have been looking on some site’s that hint at having to embedd a sound file in the html file????!!!! is this true?
Can’t seem to get the beep function to work at all.
If you look at the HTML ,, is there anything i can get rid of, strip away,?
what’s not needed.
Another question, If i wanted to display the Hours and mins further up on the screen, leaving the 100 count at the bottom, how would i do this?
Sorry i am still unable to post any code, still keep getting an error 404 when posting.Thanks.
Uplink1001
BrandonMemberI will look at it when I get home tonight. Just out of curiosity, what kind of device are you testing this on?
Uplink1001MemberHi.
Using IOS, iPhone 4.
Sorry for late reply, working nights this week.Uplink1001
Uplink1001MemberHi.
Any chance, have you had a look at the attached file yet.?Awaiting your reply..
Uplink1001
BrandonMemberFor some reason the Beep function from PhoneGap does not seem to be working for me, not even in a different project.
Have you tried using a audio widget with a beep sound, this may be more effective.
Uplink1001MemberHI
Added an Audio widget as you said and entered the following in the Run Javascript ( for the start button)start();
var audioWidget1 = AudioPlayerWidget.fromWidget(‘m1-CPRstopwatch-audio1-container’);
audioWidget1.setMedia(‘100bpm.mp3’);// change to your sound file name
audioWidget1.play();then added for the stop button
stop();
var audioWidget1 = AudioPlayerWidget.fromWidget(‘m1-CPRstopwatch-audio1-container’);
audioWidget1.setMedia(‘100bpm.mp3’);// change to your sound file name
audioWidget1.stop();This seems to work fine now. it starts the timer and the sound and stops both, so i think you can close this off now.
Thanks for you help CincyPlanet.
Sorry about the cut and paste for the code, but still can’t post any code or pic’s again?Uplink1001
BrandonMemberGlad you got a solution. Ill have to look more into that beep code. Its strange, I tried adding the vibrate with the beep and it would vibrate, but not beep…could be a API bug.
-
AuthorPosts