Difference: ModulesAndTiming (4 vs. 5)

Revision 52024-03-28 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="MinimalLectures"

Python modules and timing

Python libraries are arranged as modules, containing a number of functions and/or classes. These modules must be imported before being used. You can either import the complete module, or you can import individual functions or classes to be used.

Changed:
<
<
As an example, let's study the time module. In MicrroPython the module is called utime (for micro-time) and it contains functions allowing us to delay execution for a certain amaount of time.
>
>
As an example, let's study the time module. In MicrroPython the module is called utime (for micro-time) and it contains functions allowing us to delay execution for a certain amount of time.
 
  • sleep(t) sets the program to sleep for t seconds
  • sleep_ms(t) sets the program to sleep for t ms
If, in our program which prints "Hello World!" we want to have the text printed only every second we could program this as follows:
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback