Setting a time interval for a method

I have been working on getting a "shake" register going in the accelerometer, and I pulled a good one off this board -- it registers whenever the iPhone moves quickly along any of the axis as a shake.
The problem is that the method called when the shake registers plays a sound, and the sound skips when played -- while the iPhone is still moving, the "shake" is still registering, and so as long as you shake it, the sound keeps beginning to play, resulting in a skipping noise.
Is there any way that I can make sure the method that plays the sound only runs once every five seconds or so? I tried putting flags on the accelerometer method to keep it from being run while the sound method is running, but it finishes so fast that it's not helping. I also looked at the AudioServices System sound completion proc, but it flags with a warning when I try to compile:
AudioServicesAddSystemSoundCompletion(mySound, NULL, NULL,MyAudioServicesSystemSoundCompletionProc, nil);
It's fine if the application pauses for five seconds or so after the sound plays (and in fact the sound is about three seconds long, so if I could just get the accelerometer method to not run again until the sound stops playing, that's fine, too). Any ideas?

why donÄt you just save the time of method invokation to a variable and upon starteing with you method you compare wether your last start was 5 seconds ago?

Similar Messages

  • Setting the time interval for LEDs

    hello I am new to labview, I am trying to do something simple, but made it a lot more complicated than it needs to be. I need turn on an LED and turn it off, but in random intervals, such as turn it on for 1 second, then turn it off for 2 seconds, then turn it on for 2 seconds, then turn it off for one second, so no real pattern. I need to do this to the LED for a minute, I tried a really convoluted method with a time target and case strictures, but I can only program that to activate in specific intervals, I am not able to set them. Any help will be greatly appreciated. Here is a VI of my convoluted method that didn't work.
    Attachments:
    LED time interval test.vi ‏43 KB

    You have not tried to implement altenbach's suggestion of autoindexing an array of delays.
    The Reshape Array needs to be outside the for loop. You want to reshape the 3x4 2D array into a 12 element 1D array.  What you are doing is reshaping a 3 element 1D array into a 12 element 1D array. This results in the last nine elements always = zero.
    The Arduino expects an 8-bit unsigned integer. So the data in the arrays should also be U8.
    If the index to Replace Array Subset is negative or greater than the maximum index in the 2D array, it does nothing.  I am not sure exactly what you are trying to do with the array index manipulations so I did not try to fix it.  I added some indicators to show what is happening.
    When using autoindexing on a for loop, do not also wire to N.
    The Arduino Rseource wires and the error wires should be connected through the loop boundaries with shift registers, not tunnels, particularly not autoindexing tunnels.
    I do not have an Arduino, so I used Diagram Disable structures to disable the Arduino VIs for testing without getting errors.
    You seem to be allergic to straight wires. Actually the auto wiring tool is probably on and IT is allergic to straight wires.  I find it easier to understand a block diagram where the wires do not have excessive bends.
    Lynn
    Attachments:
    Project 1 with arduino.2.vi ‏23 KB

  • How to set the time interval for data obtain through labview via write measureme

    I'm need to programme to obtain data from oscilloscope. Currently my laptop able to communicate with Agilent DSO6014A oscilloscope via USB. I'm include the write measurement in mty program and save the data in .lvm file. But the time interval in the data are too small which is in micron seconds. Is there a way to modify the interval values?

    The attached file is the capture of my diagram. Thanks.
    Attachments:
    Capture.PNG ‏56 KB

  • Time interval for contoured move

    I have a interpolator and it output the interpolated data with time interval 1ms. When I do the experiment using stepper motor controlled by 7344 (contoured move). the time interval is much bigger the 1ms, resulting in very low velocity. How to solve this problem? Increasing the time interval of interpolator? Is there anyone has any ideas? Thanks a lot!

    In contouring mode you can set the time interval for the position buffer in the Configure Buffer function. Here is the parameter description:
    Requested Interval (10 ms) is additional data for the Position
    buffer type. The Position buffer type requires a Requested Interval parameter,
    and indicates the time between contouring data points in milliseconds. For all
    other buffer types, the Requested Interval parameter is ignored.
    The controller uses the closest value it can that is greater than
    or equal to the interval value you requested. Your time interval must be an even
    multiple of the PID rate. Refer to the description for the Actual
    Interval parameter for more information.
    When used with Breakpoint or High-Speed
    Capture, Requested Interval indicates how often, in
    milliseconds, the onboard data is updated from the hardware, and the value is a
    whole number.Please note that 10 ms is the fastest interval that you can set. If your data is sampled with a 1 ms time interval and you want to use the 10 ms time interval with your 7344 you simply should decimate your contouring data array by copying every 10th value to your contouring position array.
    Best regards,
    Jochen Klier
    National Instruments Germany

  • Can I set a time limit for usage on a 5th gen ipod touch

    My daughter just got a 5th gen Ipod touch. Of course she is using it at times she shouldn't be. Is there a way to set a time limit for usage so she can be responsible for monitoring herself without us nagging all the time?

    IIt's free and here is a link https://itunes.apple.com/gb/app/parentkit-parental-controls/id600618138?mt=8

  • How to set transaction isolation level for a method in a Local Interface

              By reference at:
              http://e-docs.bea.com/wls/docs61/ejb/reference.html#1071267,
              the value for method-intf can only be "Remote" or "Home".
              My question is--
              How to set transaction isolation level for a method inside a Local Interface or
              Local_Home Interface?
              Thanks.
              Xing
              

    I'd try 6.1SP2. I'm pretty sure this works now.
              -- Rob
              Xing wrote:
              > I tried "Local", but got an error when deploying the EJB jar, saying that only
              > "Remote" or "Home" is allowed.
              >
              > Any idea?
              >
              > Xing
              >
              > Rob Woollen <[email protected]> wrote:
              > >
              > >
              > >Use LocalHome or Local.
              > >
              > >-- Rob
              > >
              > >Xing wrote:
              > >
              > >> By reference at:
              > >> http://e-docs.bea.com/wls/docs61/ejb/reference.html#1071267,
              > >> the value for method-intf can only be "Remote" or "Home".
              > >>
              > >> My question is--
              > >>
              > >> How to set transaction isolation level for a method inside a Local
              > >Interface or
              > >> Local_Home Interface?
              > >>
              > >> Thanks.
              > >>
              > >> Xing
              > >
              > >--
              > >
              > >----------------------------------------------------------------------
              > >
              > >AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
              > >
              > >by Michael Girdley, Rob Woollen, and Sandra Emerson
              > >
              > >http://learnWebLogic.com
              > >
              > >
              > >
              > >
              > ><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
              > ><html>
              > >Use LocalHome or Local.
              > ><p>-- Rob
              > ><p>Xing wrote:
              > ><blockquote TYPE=CITE>By reference at:
              > ><br>http://e-docs.bea.com/wls/docs61/ejb/reference.html#1071267,
              > ><br>the value for method-intf can only be "Remote" or "Home".
              > ><p>My question is--
              > ><p>How to set transaction isolation level for a method inside a Local
              > >Interface
              > >or
              > ><br>Local_Home Interface?
              > ><p>Thanks.
              > ><p>Xing</blockquote>
              > >
              > ><pre>--
              > >
              > >----------------------------------------------------------------------
              > >
              > >AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
              > >
              > >by Michael Girdley, Rob Woollen, and Sandra Emerson
              > >
              > >http://learnWebLogic.com</pre>
              > > </html>
              > >
              > >
              AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
              by Michael Girdley, Rob Woollen, and Sandra Emerson
              http://learnWebLogic.com
              [att1.html]
              

  • Set the time interval when BPM read e-mail to get offline adobe forms

    Hi masters
    Do you know where I can set the time interval when the BPM read the e-mail account to get the off-line adobe forms received ? I think it is 10 minutes but I need to change to 1 minute.

    there is a config attribute

  • Time taken for a method to run. ?

    I have a query regarding ascertaining the time taken
    for a method to execute
    I have a SQL statement that I reads 10,000 rows.
    String a_SQL = "Select.....from TableA";
    try {
         IQuery query = m_UC.createQuery();
         SimpleTableModel stm = query.executeSelect(a_SQL);
       }catch(SQLException se){
       // Query Over.
       private void displayJTable(){
       // display rows read from the query above.
       }          As the query is executing,I want to display a progress bar
    showing the status of the query.
    Now I cant use this :
    start = System.currentTimeMillis();
    try {
         IQuery query = m_UC.createQuery();
         SimpleTableModel stm = query.executeSelect(a_SQL);
       }catch(SQLException se){
    end = System.currentTimeMillis();
    System.out.println(" Time taken  to display " + (end - start)/1000);
                  The above will give me the time elapsed in seconds for the SQL query to execute,but
    this is not what I want.
    What i want is to use this :
           // Progress BAR executing,so I need to get to know the time
           // taken for the query to run
            try {
            the SQL execution
            }cach(){
            // Query over.
            // Stop Progres Bar.
            // Display JTable.       How can I know when to stop the Progress Bar as I have no handle
    on the time taken to execute the query?
    Any help will be appreciated

    You can have a separate thread (or maybe it's just part of the regular GUI update thread? I don't know details about GUIs) that puts up an hourglass or spinning clock hands or dancing hamster or whatever to indicate that something is going on, but like the man says, you can't know ahead of time how long it will take to run a query, so you can't show percent done. You also don't in general know ahead of time how many rows will be returned so that doesn't help you.
    You might be able to do something for the processing of the returned data, once the query completes, because then you can often get a count of the number of rows, so you process each row in a loop, and update the % done counter each time through the loop.

  • Can I set a time limit for connection to a certain WLAN?

    I would like to set a time limit for how long a client can be continously connected to the WLAN that provides my guest internet access. The user name/password is hosted on my ACS and authentication is provided by my Cisco NAC. I am using 5508 controllers (7.02) and WCS.
    Somewhere in this combination of stuff, there has to be a way to set a two hour time limit.

    If you are looking for your guest to get kicked off which requires them to log back in .. One option would be to set the WLAN session timeout to 2 hours.
    "Satisfaction does not come from knowing the solution, it comes from knowing why." - Rosalind Franklin
    ‎"I'm in a serious relationship with my Wi-Fi. You could say we have a connection."

  • I need help with setting up time machine for backup

    I would like help with setting up time machine for backup.

    You will need an external hard drive (formatted for a Mac).
    Then you plug it in and go to system preferences>time machine and select the external HD and turn it on.
    The backups are automatic.
    Barry

  • Set up time machine for macbook pro on WD passport

    how do I set up time machine for macbook pro on WD passport? I keep getting a message that the Passport needs to be erased but when I try to ease it it tells me it can't be . 

    Drive Partition and Format
    1. Open Disk Utility in your Utilities folder.
    2. After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Click on the Partition tab in the DU main window.
    3. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Click on the Options button, set the partition scheme to GUID then click on the OK button. Set the format type to Mac OS Extended (Journaled.) Click on the Apply button and wait until the process has completed.

  • How do I set the trace interval for DSC Read Trace.vi ?

    Hello;
    I am using the DSC Module's "Read Traces.vi" to read historical traces and display them on an xy graph. Normally, I update in real time every second or two and have a time interval of one hour or less, but sometimes, I want to look at a day or more of data on the trend. Since all of my variables are logged in one second intervals (although I do have a log deadband for most variables), this could potentially be a tremendously large array, and I want to minimize CPU usage and eliminate "out of memory" problems.
    Does updating the "interpolation interval" value in the vi options cluster update the data point to data point interval for all data points in a trace or just in areas that need to be interpolated, e.g  where there are gaps (due to for instance a data point value not changing more than its log deadband for a period of time)? I am wondering if I set this value to a larger number of seconds, then will it solve my problem or provide no change if all of my data points change continually.
    Thanks in advance for the help.
    Michael Hampson
    XL Automation, Inc.
    Michael Hampson
    President
    XL Automation, Inc.

    Hi Michael,
    I spent a good deal of time playing around with this, and it appears that the functionality of the Read Traces.vi's option input is to interpolate (draw a straight horizontal line in a graph) the data for all traces. This includes those that have updated within the interval (the updates are lost)... and having a larger interval would have more data loss.
    If you want to minimize disk usage, you'd want to increase the deadband so that fewer points are written to Citadel - I'm not sure what aspect of your program is concerning you with CPU usage. You mention that all of your variables are logged in one second intervals.
    Hopefully I have understood your concern and the workings of this VI. If I haven't, please post some screenshots or describe a little more clearly what you are looking to accomplish.
    For future reference, the LabVIEW DSC forum would probably be a better place to post questions, rather than fieldpoint
    Best regards,
    -Sam F, DAQ Marketing Manager
    Learn about measuring temperature
    Learn how to take voltage measurements
    Learn how to measure current

  • How to set Monitoring Discovery Interval for Group Population(GroupPopulator) in SCOM

    Hi,
    Here with I have created discovery with SystemCenter.GroupPopulator.
    <Monitoring>
        <Discoveries>
          <Discovery ID="mydiscovery" Enabled="true" Target="myclass1" ConfirmDelivery="false" Remotable="true" Priority="Normal">
            <Category>Discovery</Category>
            <DiscoveryTypes />
            <DataSource ID="DS" TypeID="SystemCenter!Microsoft.SystemCenter.GroupPopulator">
              <RuleId>$MPElement$</RuleId>
              <GroupInstanceId>$Target/Id$</GroupInstanceId>
              <MembershipRules>
                <MembershipRule>
                  <MonitoringClass>$MPElement[Name="SC_a6e117fa996b47c4ae886c188bd8b2ae_Service_b3ad7ca40a1849158c3111d9d508e724"]$</MonitoringClass>
                  <RelationshipClass>$MPElement[Name="SCMembership_ecd4ff08a512499d8cbc61f024d165f2"]$</RelationshipClass>
                </MembershipRule>
                <MembershipRule>
                  <MonitoringClass>$MPElement[Name="SC_bd2b10979bb54fcf8392edf4eda0b0e1_Service_b3ad7ca40a1849158c3111d9d508e724"]$</MonitoringClass>
                  <RelationshipClass>$MPElement[Name="SCMembership_c30716b6e57140ac96fcd406a7bce0cb"]$</RelationshipClass>
                </MembershipRule>
              </MembershipRules>
            </DataSource>
          </Discovery>
    </Discoveries>
    </Monitoring>
    i referred below link, 
    http://social.technet.microsoft.com/Forums/systemcenter/en-US/291585a6-d7e3-4c58-a703-dc0879ab2bb9/scom-discovery-interval-configuration?forum=operationsmanagergeneral
    How to set  Interval for this above discovery?
    Thanks
    -satheesh

    Thanks Chunky,
    But  FilteredRegistryDiscoveryProvider is not helped for me!!
    Here i tried to create distributed application via code. First i tried to create via wizard using scom console and saved as one new MP. It working fine and rollup the heath state changes immediately. Then deleted that MP created via Wizard and re-import
    that same MP again in to SCOM. It not rollup the state changes immediately. It took time like 4-6 hrs to rollup the state changes.
    pls check my link,
    http://social.technet.microsoft.com/Forums/systemcenter/en-US/1317dfa1-a124-47b3-97a7-f8bb05ae40c9/not-monitored-state-for-rollup-monitor-in-distributed-application-help-me?forum=operationsmanagergeneral
    I tried to find out solution for it. So i tried to run that discovery on Frequency based and rollup the recent heath state.
    Why its working while i created distributed application via Wizard, but it took more time for  rollup If i re-import that same MP again?.
    - satheesh

  • DateTimePicker -  Setting the Time Interval

    Hi,
    I am using the DateTimePicker, which shows me from 0-59 Minutes the time.
    I want to change it to have intervals of 15 minutes, to see 00, 15, 30, 45 minutes.
    Is there any way to set up this interval?
    Cheers
    Jens

    Sorry for late reply.
    DateFomat sets only the format.
    What I want to adchive is the INTERVALL for the Minutes, e.g. 00, 15, 30, 45
    When you use this control to create an appointment, nobody wants to create a date of 12:37 ...
    Jens

  • Setting up Time Capsule for backup only on existing wireless network

    I have a wireless network already set up with a NetGear wireless router. Cable plugs into router, router connected via ethernet cable to my Power Mac G5 desktop, plus 2 PC laptops in the house also connect wirelessly to the home network via this router.
    I want to set up Time Capsule as an external hard drive to back up all three computers -- I don't necessarily need to use it as a wireless router although i'm not opposed to that if it's easier to do it that way.
    When i try to set it up using AirPort utility, i get the amber flashing light. Airport utility is able to discover the device, and then always asks if it's OK to switch networks. I've tried both "switch" and "don't switch"; either way when i try to set it up, AirPort utility stalls out on "Reading Time Capsule Configuration"; eventually giving me the error msg: "Base Station Error: AirPort Utility was unable to find your Apple wireless device."
    All i want to do is mount it as an external hard drive so i can use Time Machine for backup, and be able to use it to also back up the PC laptops wirelessly. I need help in the following three areas:
    1. How should I be physically connecting my devices if i want to do this? Which cables go in which ports? There is only one ethernet port on the back of my G5. The G5 can connect to the router either wirelessly OR via ethernet cable. I've tried G5-->Time Capsule-->Router, G5-->Router-->Time Capsule, Router-->G5 PLUS Router-->Time Capsule, and I've tried every variation on the regular ethernet and WAN ports. What's the right way to do this.
    2. If i'm not setting up the TC as a Wireless Router, is AirPort utility even the right tool for setting it up? it seems to be confused by the two wireless networks and won't let me get past that point. Am I supposed to click "Switch" when it asks me to switch networks? Is there a way to just mount it as an external drive and bypass the AirPort utility setup entirely?
    3. Once i get it set up so it's visible as an external drive and usable for Time Machine backup, how do i then make it available to the other PCs on the network so they can back up to it also?
    Thanks for your help.

    sarah,
    You already have an existing wireless network.
    You do not need to plug the Time Capsule into anything except power.
    Set the Time Capsule to "Join an existing wireless network"...
    That is all you need to do.
    Then all the computers should see the Time Capsule.
    If you can't see "Join an existing wireless network" in the choices, hold down on the option key and then click on the choices.
    Give that a try.

Maybe you are looking for