Skip to content

Change timer value on the fly #72

Description

@2kohm

Hello,
i want to change the timer intervall on the fly

i generate the intervall time with an formula

int myVar = 0;
double ticks = 60000000.0 / (myVar * 96.0);

void clock1()
    {
        // do stuff here
    }

void setup()
{
	Timer2.attachInterrupt(clock1); 
}

void loop () 
{
    if ( something == 1) 
    {
        Timer2.start(ticks);
    }

    if ( somethingElse)  
        {
            myVar = 120;
        }
    }
}

how can i update the changed value on the fly? do i have to stop and start the Timer again ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions