This is the documentation for the latest development branch of MicroPython and may refer to features that are not available in released versions.

If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version.

Getting started with MicroPython on the PSoC6™

This tutorial will guide you to get started with running MicroPython on the PSoC6™ microcontrollers. There are only a few step keeping you away from enjoying the python programming experience together with the possibilities of PSoC6™ microcontrollers.

Let’s get started!

Requirements

The only required hardware is:

Power the board

Connect the USB cable to your computer and the micro USB to the board debugger. All the PSoC6™ boards come with a on-board debugger required for flashing/debugging operations during development. Please refer to the corresponding board manual of your board.

Install MicroPython

In your computer terminal, type the following commands and follow the instructions:

Download the mpy-psoc6 utility script:

curl -s -L https://raw.githubusercontent.com/infineon/micropython/ports-psoc6-main/tools/psoc6/mpy-psoc6.py > mpy-psoc6.py

Make sure you have a recent version on Python3.x installed and the pip package installer. Then install the following packages:

pip install requests

Finally run the script:

python mpy-psoc6.py quick-start

These commands will download and run the quick-start command of the mpy-psoc6 utility and take care of all the necessary installation steps.

If everything went fine, your PSoC6™ board is now running MicroPython and Arduino IDE for Micropython is now started. If you run into any trouble, please let us know here :)

Select your serial port of your PSoC6™ board by clicking on the connect icon on the menu bar:

Arduino IDE connect

Interact with the MicroPython prompt

As in python, you can use the prompt mode. Simply start typing some python commands:

Arduino IDE prompt

Run your first script

Let’s try now to run a MicroPython script. As a first example, you will turn on the board LED.

Copy the following code in the editor and click on run.

from machine import Pin

p1 = Pin("P13_7")   # LED pin for CY8CPROT-062-4343W
p1.init(Pin.OUT)
p1.on()
Arduino IDE script

The red LED in the board should be now on :D

Upload a script to your device

Feature unavailable. Placeholder. To be completed.

You are all set now to start programming with MicroPython!

Learn more about MicroPython in the following sections: