function start_doing_stuff() {
    // If doing_stuff is already doing, stop doing it
    if ((typeof doing_stuff_timer !== 'undefined')) {
        clearInterval(doing_stuff_timer);  
    }
    // Start data acquisition timer at regular integral
    doing_stuff_timer = setInterval(function() { doing_stuff() }, 500);
}
// Do something at a regular interval
Do something at a regular interval
Do something at a regular interval
function start_doing_stuff() {
    if ((typeof doing_stuff_timer !== 'undefined')) {
        clearInterval(doing_stuff_timer);  
    }
    doing_stuff_timer = setInterval(function() { doing_stuff() }, 500);
}
function start_doing_stuff ( ) { if ( ( typeof doing_stuff_timer !== 'undefined' ) ) { clearInterval ( doing_stuff_timer ) ; } doing_stuff_timer = setInterval ( function ( ) { doing_stuff ( ) } , 500 ) ; }
Do something at a regular interval
Do something at a regular interval
// If doing_stuff is already doing, stop doing it // Start data acquisition timer at regular integral