Java Timer vs MetaWear Timer module

Is there any fundamental difference between using Java's built in Timer function and MetaWear's? Can I use them concurrently if needed?

What I want to do is have a Start function that onClick initiates a cycle of logging for 8 hours, stops, downloads and repeats until either the battery runs out or the process is manually stopped by the user.


  • Hey @jjm345, can you be more specific?

  • Here's some pseudo-code I'm working on...

        Function to initiate timed sequence of events (){
            onClick (START button):
                while Battery_level is GOOD:
                    Initiate accelerometer (with range/frequency hard-coded)
                    Start Logging (MetaWear Timer countdown from 8 hours starts)
                When 8 hours is reached:
                    Stop Logging
                    Download data
                If battery_runs out mid cycle
                    upon battery replacement/recharge
                    download  content.
                    Start new cycle             

    The process will repeat unless a user presses the STOP button. STOP will interrupt the logging and immediately download whatever has been captured.

  • I am checking to see if it is more advantageous to work with MetaWear timer or Java's built-in Timer function.

  • edited June 2021

    So the MetaWear time is internal to the Sensor itself. That's the clock in the CPU of the MetaSensor.
    The Java timer is in the App only (the sensor doesn't know anything about this timer).

  • @Laura Ok, I will use Metawear to run the sequential logic then, thanks!

Sign In or Register to comment.