472,347 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,347 software developers and data experts.

C# ...1 beep 1 second silence

I need to write a C# program that asks for a pattern and for each pattern beeps one and goes silence for 1 second.
This is my code:
for (int i=0;i< pattern; i++)
***************** //I have no idea what to put for 1 sec of silence


any suggestions???
Feb 19 '09 #1
3 4093
7,872 Expert 4TB
Try using Thread.Sleep()
Feb 19 '09 #2
3,525 Expert 2GB
Be honest... This is a programming class homework assignment, right?
I'm going to guess the next step to the ambulance siren assignment

Posting guidelines about homework

How much looking around the internet have you done on this? How many different methods have you tried, before asking for help? Have you tried a google search for 'time delay' or 'wait loop' or 'time check' or 'time compare' etc.?

By the way a for loop counting the way you have won't get you 1 second of beeping. It will get you beeping for however long it takes that particular PC to count to your supplied number ("pattern"). A 1 GHz computer will beep 3 times longer than a 3 GHz computer, since it will take longer for it to count to the same maximum number.

You might want to look at DateTime objects. This way you can check the DateTime before you go into the loop, keep checking it while in the loop, and then break out of the loop when the current time is greater than the start time plus 1 second.

TIP: If you read the above paragraph like a word problem, it heavily hints at the code you would write to do it.
Feb 19 '09 #3
229 Expert 100+
I wouldn't say too much, since there is a sample in MSDN for Console.Beep that does the same thing:

Feb 20 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Leo | last post by:
hi there i want python to do a beep. in the docu i found in tkinter the method bell() but the script: import Tkinter Tkinter.bell() gives...
by: #Hai | last post by:
Hi, I want to throw out a series of 'beep..beep..beep' to the speaker. How to do that ? Thanks
by: Ike | last post by:
Is there wa way to make the system beep (ascii 007...bell) via javascript (or any other simple notification sound)? Thanks, Ike
by: Birchy | last post by:
Great quotes from the Roman playwright Terence... http://www.fallingskyhazard.com/catalog.htm As a person is so must you humor them. He...
by: Ferhat Akcin via .NET 247 | last post by:
Hi all, I have a picture box which blinking each quarter a second. Iwant to Beep() whenever it blinks. I tried the PInvoked Beepfunction, but it...
by: Sakharam Phapale | last post by:
Hi All, I am developing an application like sound recorder. While recording if there is a silence for more than given time (say 5...
by: =?Utf-8?B?UmljaA==?= | last post by:
When I press the Enter key in a Textbox I get a beep sound. But when I press the Enter key in a combobox, I don't get the beep sound. Is there a...
by: carthia | last post by:
Hello All, I need to determine speaking time, but without pressing any button (such as start speaking/stop speaking), e.g. how long each...
by: Anz | last post by:
Is there any JavaScript function to generate a Beep sound from system ?, is it possible to make system Beep using JavaScript function ?
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.