Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumProgramming Questions & HelpSyntax › Millis() reset?

Page Index Toggle Pages: 1
Millis() reset? (Read 8031 times)
08/09/09 at 18:18:58

Titus   Offline
Full Member
Wiring Soccer Robot!
Amsterdam

Posts: 176
***
 
Hi Barragan,

I'm building a 3x3x3 led cube, controlling it with 12 i/o pins.
To achieve this I had to multiplex a lot.
During writing the code I stumbled across a problem:

I wondered, is there a way to reset the Millis() function?
Because I want to loop some sequences involving multiplexing leds, so I'd basically wanted to do the following:

void loop()
{
*loop this for 4 seconds*
*loop this for 2 seconds*
*loop this for 3 seconds*
}

where every "* loop this etc*" consists of quite a few actions that run really fast(turn leds on for 1 ms and then off, because of the multiplexing)

while( Millis() < 4000)
{
things to loop
}
*RESET Millis()*
while ( Millis() < 2000)
{
etc


This way I would loop a sequence of loops.
I know it sounds strange, but is there a way to reset the Millis() function. If that would be possible it would be great!

I don't mind changing things in the source code or what ever Cheesy

Thanks!!!

Titus

P.S. Kars and I got second on the world championships robocup junior soccer with our wiring soccer robots!
A website will soon be online for the exhibition!
 

Check www.TeamVossius.nl for our Autonomous soccer robots!
IP Logged
 
Reply #1 - 08/10/09 at 16:50:34

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
hi Titus this can be done in this way using a variable to keep your time, so the variable can be reset when you need it: http://wiring.org.co/learning/examples/timer.html
 
IP Logged
 
Reply #2 - 08/10/09 at 17:16:52

Titus   Offline
Full Member
Wiring Soccer Robot!
Amsterdam

Posts: 176
***
 
I knew I should have thought of that. Thanks.

 

Check www.TeamVossius.nl for our Autonomous soccer robots!
IP Logged
 
Reply #3 - 11/12/10 at 02:10:01

mga   Offline
YaBB Newbies

Posts: 41
*
 
The link referenced changed. New location: http://wiring.org.co/learning/basics/timer.html
 
IP Logged
 
Page Index Toggle Pages: 1