Jump to content

[Version 1] Odd Timer Drift?


Recommended Posts

I've encountered a problem with millis() function in Teensyduino.It seems that after my program runs for awhile, the clock on the Teensy seems to slow down and not give accurate results. It seems to be a side effect of me using my "CommandAtRunBarMSWIN" function, but the only time related function I use in it is delay() and when I tested with just that it the loop did not seem to skew the clock. I'm using the latest alpha to my knowledge. Ideas?

Adrian

void CommandAtRunBarMSWIN(char *SomeCommand){

//digitalWrite(ledPin, HIGH); // set the LED on

Keyboard.set_modifier(MODIFIERKEY_RIGHT_GUI); //Windows key

Keyboard.set_key1(KEY_R); // use r key

Keyboard.send_now(); // send strokes

Keyboard.set_modifier(0); //prep release of control keys

Keyboard.set_key1(0); //have to do this to keep it from hitting key multiple times.

Keyboard.send_now(); //Send the key changes

delay(1500);

Keyboard.print(SomeCommand);

Keyboard.set_key1(KEY_ENTER);

Keyboard.send_now();

Keyboard.set_key1(0);

Keyboard.send_now();

}

Link to comment
Share on other sites

Paul explained it to me, seems using the SD takes a lot of CPU time on the Teensy, and causes the clock to have issues.

So does that mean we shouldn't use the clock? Or we should add more delay time? I wonder, does it have the same effect on all operating systems? I'm getting ready to incorporate the sd card to the Teensy and I just want to know whether this will cause problems later on... Thanks for your posts, it really helps me understand how to use Teensy. I'm still new at this..:]

Bits1

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...