> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/wokwi/wokwi-docs/llms.txt
> Use this file to discover all available pages before exploring further.

# CircuitPython on Wokwi

> Simulate CircuitPython on Wokwi using the Raspberry Pi Pico. This guide covers project setup, using Adafruit libraries, and exploring the CircuitPython REPL.

You can simulate CircuitPython on Wokwi using the [Raspberry Pi Pico board](/parts/wokwi-pi-pico). To start a new simulation project, open the [Raspberry Pi Pico CircuitPython project template](https://wokwi.com/projects/new/circuitpython-pi-pico).

## Project structure

CircuitPython projects must include a `code.py` file. The code in this file will execute when you start the simulation.

Wokwi copies all the project files into the Pico's flash file system. This means your project can include additional Python modules and you can import them from `code.py` or from the interactive REPL. Your project can also include custom data inside text files.

You can get a list of all the files in the flash filesystem by running:

```python theme={null}
import os
print(os.listdir('/'))
```

## Using libraries

You can use any library from the [Adafruit CircuitPython Bundle](https://github.com/adafruit/Adafruit_CircuitPython_Bundle). Create a "requirements.txt" file in your project, and write the names of the libraries that you use, one per line. Lines that start with "#" are comments.

For example, if you want to install both [adafruit\_display\_text](https://circuitpython.readthedocs.io/projects/display_text/en/latest/) and [adafruit\_dht](https://circuitpython.readthedocs.io/projects/dht/en/latest/), create a "requirements.txt" file with the following content:

```txt theme={null}
# requirements.txt example
adafruit_display_text
adafruit_dht
```

<Tip>
  When you start the simulation, Wokwi downloads all the libraries and their dependencies. It copies them into the "lib" folder in the flash filesystem. You can call `os.listdir('/lib')` to get a list of all the libraries installed. For a complete code example, see [CircuitPython Library List](https://wokwi.com/projects/309475039016649280).
</Tip>

## CircuitPython REPL

When the code in `code.py` terminates (or you interrupt it with Ctrl+C), you'll get into the CircuitPython REPL. The REPL is an interactive prompt where you can type python commands and see the results immediately.

<Tip>
  To paste code into the REPL type Ctrl+E and enter paste mode.
</Tip>

## Project examples

<CardGroup cols={2}>
  <Card title="Blink with CircuitPython" icon="lightbulb" href="https://wokwi.com/projects/309474946192507458">
    Simple LED blinking example
  </Card>

  <Card title="CircuitPython SSD1306 Example" icon="display" href="https://wokwi.com/projects/309427357921313345">
    Display text on an OLED screen
  </Card>
</CardGroup>
