[Digi-Key Follow me Issue 1] First post: Unboxing and Mu environment setup, lighting
[Copy link]
This post was last edited by walker2048 on 2023-6-27 15:40
I am very happy to have the opportunity to participate in the "Follow me" event of Digi-Key. I received the development board and other kits smoothly within 10 days after placing the order on the Digi-Key website. I was in a hurry at that time, so I didn't have time to take more photos. The unboxing pictures are a bit messy
After receiving the board, we will now start installing the environment. The environment used is CircuitPython and Mu
CircuitPython is very simple. Open a browser and visit the picow firmware address provided by the official website of Adafruit CircuitPython ( https://circuitpython.org/board/raspberry_pi_pico_w/ ).
Then click the download button on the web page (as shown below) to download the firmware
Next, take out the pico-w development board, press and hold the BootSel button on the board, and then plug in the USB cable. If everything goes well, there will be an extra USB flash drive in your computer. Drag the UF2 file you just downloaded into the USB flash drive. After about ten seconds, the computer will recognize a new USB flash drive with the name of CircuitPython, and you can start developing CircuitPython.
In addition to firmware, we also need to use many peripheral libraries. At this time, you need to go to the official library download page of CircuitPython.
All libraries and example codes can be downloaded from this page. Address: ( https://circuitpython.org/libraries)
After opening the page, scroll down to the purple buttons and download the Bundle for Version 8.x (the version should be consistent with the version of CircuitPython you burned, for example, if you burned version 8.1, you should download the 8.x library). It is recommended to also download the source code (you can use the source code library or the compressed Bundle library). The difference is as shown below.
In addition to directly using VSCode to open the USB disk file for editing, you can also use the Mu tool to write code for the CircuitPython project.
You can download the latest mu tool from Mu’s official website https://codewith.mu/ . After downloading, just click to install it as shown in the figure below.
It takes about two minutes to install. Finally, click Finish to open mu and start playing picow.
The first time you open mu, you need to configure the Python virtual environment. It will be very fast to open it later.
Next, it’s time to light up the lights. I looked up some CircuitPython case code and was able to quickly write the following code based on the case demo.
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
import board
import digitalio
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
while True:
led.value = True
time.sleep(0.5)
led.value = False
time.sleep(0.3)
Use Mu to open the code.py file in the root directory of the USB drive, then copy the above code into mu and save it.
You can see the LED on the board flashing smoothly. Isn’t it very simple?
You can also try using the NeoPixel library to light up the WS2812, which comes with several different animation effects.
|