diff options
| author | Marti Bolivar <mbolivar@mit.edu> | 2010-11-29 01:49:26 -0500 | 
|---|---|---|
| committer | Marti Bolivar <mbolivar@mit.edu> | 2010-11-29 01:49:26 -0500 | 
| commit | ee35f641687d0d3159c15eea5ad80d71efff4f82 (patch) | |
| tree | d58e470a42623a1fba3eccbab324a26316d60398 /source/lang/millis.rst | |
| parent | d9cbd78e29d42e70bb46641dd43ee0772c8c975f (diff) | |
| download | librambutan-ee35f641687d0d3159c15eea5ad80d71efff4f82.tar.gz librambutan-ee35f641687d0d3159c15eea5ad80d71efff4f82.zip | |
Finished converting the Arduino docs
Diffstat (limited to 'source/lang/millis.rst')
| -rw-r--r-- | source/lang/millis.rst | 70 | 
1 files changed, 26 insertions, 44 deletions
| diff --git a/source/lang/millis.rst b/source/lang/millis.rst index 6ebfff5..54e4507 100644 --- a/source/lang/millis.rst +++ b/source/lang/millis.rst @@ -1,70 +1,52 @@ +.. highlight:: cpp +  .. _lang-millis:  millis()  ======== -Description ------------ - -Returns the number of milliseconds since the Arduino board began -running the current program. This number will overflow (go back to -zero), after approximately 50 days. - - - -Parameters ----------- - -None - - - -Returns -------- - -Number of milliseconds since the program started (*unsigned long*) +Returns the number of milliseconds since the Maple board began running +the current program. This number will overflow (go back to zero) after +approximately 50 days. +Library Documentation +--------------------- +.. doxygenfunction:: millis  Example  ------- -:: +The following time prints the value returned by ``millis()`` roughly +once per second:: -    unsigned long time; +    unsigned int time; -    void setup(){ -      Serial.begin(9600); +    void setup() {      } -    void loop(){ -      Serial.print("Time: "); + +    void loop() { +      SerialUSB.print("Time: ");        time = millis(); -      //prints time since program started +      // prints time since program started        Serial.println(time); +        // wait a second so as not to send massive amounts of data        delay(1000);      } +Tip +--- +Since the return value for ``millis()`` is an :ref:`unsigned long +<lang-unsignedlong>`, overflow errors may occur if you try to do math +with other data types, such as :ref:`ints <lang-int>`. -Tip: ----- - -Note that the parameter for millis is an unsigned long, errors may -be generated if a programmer tries to do math with other datatypes -such as ints. - - - -See also +See Also  -------- - --  `micros <http://arduino.cc/en/Reference/Micros>`_\ () --  `delay <http://arduino.cc/en/Reference/Delay>`_\ () --  `delayMicroseconds <http://arduino.cc/en/Reference/DelayMicroseconds>`_\ () --  `Tutorial: Blink Without Delay <http://arduino.cc/en/Tutorial/BlinkWithoutDelay>`_ - - +- :ref:`micros <lang-micros>` +- :ref:`delay <lang-delay>` +- :ref:`delayMicroseconds <lang-delaymicroseconds>`  .. include:: cc-attribution.txt | 
