Thread#
Initializing the Thread Class#
A Thread is created by using the following constructor:
Thread(callback, arg)
This constructor uses two parameters:
| Parameter | Description | 
|---|---|
| 
 | A previously defined function that will be executed as the entry point when the thread is invoked. | 
| 
 | Optional. A tuple that is used to pass arguments to the thread entry function. | 
# Define the function "thread_print".
def thread_print():
    brain.screen.print("Printing!")
# Construct a Thread "thread" with the
# Thread class.
thread = Thread(thread_print)
This thread object will be used in all subsequent examples throughout this API documentation when referring to Thread class methods.
Class Methods#
stop()#
The stop() method stops the thread.
Returns: None.
sleep_for()#
The sleep_for(duration, units) method makes the thread sleep for a specified duration.
| Parameters | Description | 
|---|---|
| 
 | The duration for which the thread should sleep. | 
| 
 | Optional. A valid  | 
Returns: None.