Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setTime en seconds() is 4 times slower #7

Closed
demobiel opened this issue Apr 2, 2021 · 1 comment
Closed

setTime en seconds() is 4 times slower #7

demobiel opened this issue Apr 2, 2021 · 1 comment

Comments

@demobiel
Copy link

demobiel commented Apr 2, 2021

Hi,

I am controlling 2 motors, and using your repo as arduino framework.

It looks like it works, but when using the functions setTime ( ) and call the current time with seconds(), the seconds() only updates every 4 seconds, or the time is running 4 times slower then my stopwatch.

this is my setup code:

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  setPrescaler(0, 1);
  setPrescaler(1, 1);
  setPrescaler(2, 1);
  setTime(1, 0, 0, 1, 1, 1);
}

and this is my loop code

void loop(void)
{
  // the motor only moves when you call update()
  motor.update();  
  if(second() != currentS){
    //move to next second
    currentS = second();
    motor.setPosition(currentS * 72);
  }
}

when I disable the line setPrescaler(0, 1);
it runs perfectly, but activating it, suddenly slows down the clock by a factor 4

@demobiel
Copy link
Author

demobiel commented Apr 2, 2021

problem is not here, but in Time library! sorry for disturbing!

@demobiel demobiel closed this as completed Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant