Adafruit Circuit Playground Express Created by lady ada Last updated on 2018-12-13 04:58:58 PM UTC
Guide Contents Guide Contents Overview Classic vs.
Downloading and Flashing Step 1: Bootloader mode Step 2: Compile and Download Running MakeCode that's Already Loaded Saving and Sharing 38 38 39 40 41 Extracting your code from the Circuit Playground Sharing Editing JavaScript Apps Windows Store Node.
Using Something Else? Interacting with the Serial Console The REPL Returning to the serial console CircuitPython Libraries 63 64 67 70 72 Installing the CircuitPython Library Bundle Example Files Express Boards Non-Express Boards Example: ImportError Due to Missing Library Library Install on Non-Express Boards Updating CircuitPython Libraries/Examples 72 73 74 74 74 75 76 Troubleshooting Always Run the Latest Version of CircuitPython and Libraries CPLAYBOOT, TRINKETBOOT, FEATHERBOOT, or GEMMABOOT Drive
CircuitPython Playground CircuitPython Built-Ins Thing That Are Built In and Work Flow Control Math Tuples, Lists, Arrays, and Dictionaries Classes, Objects and Functions Lambdas Random Numbers CircuitPython Digital In & Out Going Beyond the Lesson! 93 94 94 94 94 94 94 94 94 95 96 Experiment 1 Experiment 2 96 96 CircuitPython Analog In 98 Creating an Analog Input GetVoltage Helper Main Loop 99 99 99 CircuitPython Analog Out 101 Creating an analog output Setting the analog output Main Loop Find
Read the Docs 133 CircuitPython UART Serial The Code Wire It Up Where's my UART? Trinket M0: Create UART before I2C 134 134 135 138 139 CircuitPython I2C 141 Wire It Up Find Your Sensor I2C Sensor Data Where's my I2C? 141 144 145 146 CircuitPython HID Keyboard CircuitPython HID Keyboard and Mouse 148 151 CircuitPython Keyboard Emulator Create the Objects and Variables The Main Loop 151 152 153 CircuitPython Mouse Emulator 153 Create the Objects and Variables CircuitPython HID Mouse Helpers Mai
Playground Temperature Playground Drum Machine Playground Sound Meter Arduino Set Up Arduino IDE Install SAMD Support Install Drivers (Windows 7 Only) Blink Sucessful Upload Compilation Issues Manually bootloading Ubuntu & Linux Issue Fix Arduino Switches Without Library Assist 183 Adapting Sketches to M0 Analog References Pin Outputs & Pullups Serial vs SerialUSB AnalogWrite / PWM on Feather/Metro M0 analogWrite() PWM range analogWrite() DAC on A0 Missing header files Bootloader Launching Aligned Memory
Copper Foil Tape with Conductive Adhesive - 25mm x 15 meter roll Copper Foil Tape with Conductive Adhesive - 6mm x 15 meter roll Proto-Pasta - 1.75mm 500g Conductive PLA Filament Proto-pasta - 2.
Overview Circuit Playground Express is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and made it even better! Not only did we pack even more sensors in, we also made it even easier to program. Start your journey with Microsoft MakeCode block-based or Javascript programming (https://adafru.it/wWd). Or, you can follow along with code.org CS Discoveries (https://adafru.it/BVX).
Here's some of the great goodies baked in to each Circuit Playground Express: 10 x mini NeoPixels, each one can display any color 1 x Motion sensor (LIS3DH triple-axis accelerometer with tap detection, free-fall detection) 1 x Temperature sensor (thermistor) 1 x Light sensor (phototransistor). Can also act as a color sensor and pulse sensor. 1 x Sound sensor (MEMS microphone) 1 x Mini speaker with class D amplifier (7.
© Adafruit Industries https://learn.adafruit.
Classic vs. Express Circuit Playground started its life as a board with simple requirements - just work with Arduino IDE and Code.org. But since it's initial launch in 2015 we've learned a lot and improved the board greatly! There are TWO Circuit Playgrounds - one Classic and one Express. The Classic version can run Arduino and Code.org The Express version can run MakeCode, CircuitPython, Arduino, and Code.org CS Discoveries.
Express boards have CIRCUIT PLAYGROUND EXPRESS on the back lower half. They'll also note the chip is an ATSAMD21 © Adafruit Industries https://learn.adafruit.
Guided Tour Let me take you on a tour of your Circuit Playground Express (we'll shorten that to CPX). Each CPX is assembled here at Adafruit and comes chock-full of good design to make it a joy to use. Power and Data Micro B USB connector This is at the top of the board. We went with the tried and true micro-B USB connector for power and/or USB communication (bootloader, serial, HID, etc). Use with any computer with a standard data/sync cable. © Adafruit Industries https://learn.adafruit.
JST Battery Input This is at the bottom of the board. You can take your CPX anywhere and power it from an external battery. This pin can take up 6V DC input, and has reversepolarity, over-current and thermal protections. The circuitry inside will use either the battery input power or USB power, safely switching from one to the other. If both are connected, it will use whichever has the higher voltage. Works great with a Lithium Polymer battery or our 3xAAA battery packs with a JST connector on the end.
The brains of the operation here is the ATSAMD21G18 a Cortex M0 microcontroller. This chip is much more powerful than the original Circuit Playground. It sits in the top center, and is what you use to run MakeCode, CircuitPython or Arduino! New in Circuit Playground Express, we have added a new storage chip, called SPI Flash. This is a very, very small disk drive, only 2 MB large. You can use this in Arduino or CircuitPython to store files.
Green ON LED To the left of the USB connector. This LED lets you know that the CPX is powered on. If it's lit, power is good! If it's dim, flickering or off, there's a power problem and you will have problems. You can't disable this light, but you can cover it with electrical tape if you want to make it black. Red #13 LED To the right of the USB connector. This LED does double duty. Its connected with a series resistor to the digital #13 GPIO pin.
10 x Color NeoPixel LED The ten LEDs surrounding the outer edge of the boards are all full color, RGB LEDs, each one can be set to any color in the rainbow. Great for beautiful lighting effects! The NeoPixels will also help you know when the bootloader is running (they will turn green) or if it failed to initialize USB when connected to a computer (they will turn red).
The speaker is the squarish gray chunk on the bottom left of the board. There is a small class D amplifier connected to the speaker so it can get quite loud! Note: it won't sound good if too loud, so some experimentation may be necessary The amplifier is connected to the true analog output A0 pin -- this pin is also available on one of the connection pads in the lower right. You can tell it's the analog output pin because of the squiggly symbol.
Light Sensor There is an analog light sensor, part number ALSPT19 (https://adafru.it/tC2), in the top left part of the board. This can be used to detect ambient light, with similar spectral response to the human eye. This sensor is connect to analog pin A8 and will read between 0 and 1023 with higher values corresponding to higher light levels. A reading of about 300 is common for most indoor light levels.
Motion Sensor We can sense motion with an accelerometer. This sensor detects acceleration which means it can be used to detect when its being moved around, as well as gravitational pull in order to detect orientation. The LIS3DH 3-axis XYZ accelerometer is in the dead center of the board and you can use it to detect tilt, gravity, motion, as well as 'tap' and 'double tap' strikes on the board.
There are two large A and B buttons, connected to digital #4 (Left) and #5 (Right) each. These are unconnected when not pressed, and connected to 3.3V when pressed, so they read HIGH. Set the pins #4 and #5 to use an internal pull-down resistor when reading these pins so they will read LOW when not pressed. This small button in the center of the board is for Resetting the board. You can use this button to restart or reset the CPX.
There is a single slide switch near the center bottom of the Circuit Playground Express. It is connected to digital #7. The switch is unconnected when slid to the left and connected to ground when slid to the right. Set pin #7 to use an internal pull-up resistor so that the switch will read HIGH when slid to the left and LOW when slid to the right.
Pinouts Despite having only 14 pads with 8 general purpose I/O pins available, there are a lot of possibilities with Circuit Playground Express. We went over all the internals in the last page. On this page we'll go through each pin/pad to explain what you can do with it. Other than A0, no external I/O pads are shared with internal sensors/devices, so you do not need to worry about 'conflicting' pins or interactions! Power Pads © Adafruit Industries https://learn.adafruit.
There are 6 power pads available, equally spaced around the perimeter. GND - there are 3 x Ground pads. They are all connected together, and are all the signal/power ground connections 3.3V - there are two 3.3 Volt output pads. They are connected to the output of the onboard regulator.
Each pad can provide up to ~20mA of current. Don't connect a motor or other high-power component directly to the pins! Instead, use a transistor to power the DC motor on/off (https://adafru.it/aUD) All of the GPIO pads are 3.3V output level, and should not be used with 5V inputs. In general, most 5V devices are OK with 3.3V output though.
D32 (PIN_SPI_MOSI) - SPI FLASH MOSI D33 - SPI FLASH Chip Select © Adafruit Industries https://learn.adafruit.
Windows Driver Installation Mac and Linux do not require drivers, only Windows folks need to do this step Before you plug in your board, you'll need to possibly install a driver! Click below to download our Driver Installer. https://adafru.it/AB0 https://adafru.it/AB0 Download and run the installer.
On Windows 7, by default, we install a single driver for most of Adafruit's boards, including the Feather 32u4, the Feather M0, Feather M0, Express, Circuit Playground, Circuit Playground Express, Gemma M0, Trinket M0, Metro M0 Express. On Windows 10 that driver is not necessary (it's built in to Windows) and it will not be listed. The Trinket / Pro Trinket / Gemma / USBtinyISP drivers are also installed by default.
https://adafru.it/AB0 And point windows to the Drivers folder when it asks for the driver location © Adafruit Industries https://learn.adafruit.
Code.org CSD Did you know you can use the Circuit Playground Express (CPX) with Code.org CS Discoveries course? Well you can now! All you have to do is load up the "Firmata" firmware onto your CPX. Luckily, its very easy and you only have to do this once per device Step 1.
Click this link to download FIRMATA yyyy-mm-dd.UF2 (the year, month, date may vary) and drag that onto the drive https://adafru.it/AGk https://adafru.it/AGk The CPX will reboot automatically after a few seconds. The CPLAYBOOT disk drive will go away (you may get a warning from the computer that it didn't expect the ejection, ignore it!) Your CPX is now ready to run Code.org CS Discoveries! © Adafruit Industries https://learn.adafruit.
MakeCode One of the beautiful things about Circuit Playground Express is that you can make three ways: 1. MakeCode (https://adafru.it/wmd) 2. CircuitPython (https://adafru.it/BeW) 3. Arduino IDE (or direct ARM GCC programming) If this is your very first time programming or coding, we suggest starting with MakeCode (https://adafru.it/wmd) - it is the super fast to get started not just with Circuit Playground Express, but coding in general! (Once you've got the hang of MakeCode (https://adafru.
What is MakeCode? Microsoft MakeCode for Adafruit is a web-based code editor for physical computing. It provides a block editor, similar to Scratch or Code.org, and also a JavaScript editor for more advanced users. Try it now at https://makecode.adafruit.com/ (https://adafru.it/wmd) ! Some of the key features of MakeCode are: web based editor: nothing to install cross platform: works in most modern browsers (https://adafru.
$24.95 IN STOCK ADD TO CART Circuit Playground Express - Base Kit $29.95 IN STOCK ADD TO CART MakeCode works for the Express edition of the Circuit Playground, not the Classic. https://adafru.it/BAj https://adafru.it/BAj © Adafruit Industries https://learn.adafruit.
Editing Blocks The block editor is the easiest way to get started with MakeCode. You can drag and drop blocks from the category list. Each time you make a change to the blocks, the simulator will automatically restart and run the code. You can test your program in the browser! try our getting started tutorial (https://adafru.it/wmd) that helps you build a siren program try one of our projects (https://adafru.it/wpD) to learn more about the features of the Circuit Playground.
https://adafru.it/BAl https://adafru.it/BAl In the next section, we'll load the Blinky code onto the Circuit Playground Express! © Adafruit Industries https://learn.adafruit.
Downloading and Flashing Getting your code into your device is very easy with MakeCode. You do not need to install any software on your machine and the process takes two steps: Step 1: Connect your board via USB and enter bootloader mode Step 2: Compile and Download the .uf2 file into your board drive We are going to go through these two steps in detail. Step 1: Bootloader mode Connect your board to your computer via a USB cable. Press the reset button once to put the board in bootloader mode.
Once your LEDs are all green, you should see a CPLAYBOOT drive appear in your drive list in your file explorer. We are now ready to compile our blinky code and download it to our board! Step 2: Compile and Download Let's first verify that our code compiles properly in MakeCode. MakeCode has a built-in simulator that re-loads and re-runs code when restarted. This is an easy way to both ensure that our code compiles and simulate it before moving it onto the board.
microcontrollers over USB). General Steps to copy over your program (not specific to any Operating system) 1. Ensure your board is in bootloader mode. 2. Find the .uf2 file generated by MakeCode in your file explorer. Copy it to the "CPLAYBOOT" volume. 3. The status LED on the board will blink while the file is transferring.
Saving and Sharing Want to change the Blinky program to display different colors, or make it play a sound? Editing the program on your Circuit Playground is super easy! Extracting your code from the Circuit Playground The .uf2 file (CURRENT.UF2) you created by clicking on the Compile button in MakeCode also contains the source code of your program! You can open this file in MakeCode by dragging and dropping it into the browser to edit it. Sharing You can share your code by clicking on the share button.
Editing JavaScript If you already have some experience coding or you feel ready to take the next step, MakeCode features a fully-feature JavaScript editor in the browser! read the JavaScript docs Give it a try! You can also switch between blocks and JavaScript by clicking the button on the top. https://adafru.it/BAn https://adafru.it/BAn © Adafruit Industries https://learn.adafruit.
Apps MakeCode also provides various apps to provide additional features not available in browsers. Windows Store The MakeCode for Adafruit Windows Store app. Super fast HID-based flashing: no more drag and drop. Reading debug message and surfacing them in the editor (debug messages are sent over HID not CDC Uart/Serial) Node.JS The (open source) GitHub repo contains instructions to run a local node.js web server with HID flashing and serial monitoring. © Adafruit Industries https://learn.adafruit.
Other Good Stuff This guide is meant as a starter block but it's worth mentioning briefly about other feature of MakeCode... GitHub packages Additional blocks or drivers can be packaged in github repo and loaded in the editor via the Add Package dialog. Packages can contain JavaScript, C++ and yes! ASM! https://makecode.adafruit.com/packages We are Open Source on GitHub Checkout https://makecode.com/about for more info about the various repos.
MakeCode and Windows 10 Nearly all tutorials on the Adafruit Learning System are written such that the user can use the web version of MakeCode. The web version runs on multiple computer types providing broad compatibility. There is another version of MakeCode available from Microsoft in the form of an app that runs on Windows 10 machines. The big advantage the Windows 10 Microsoft Store version of MakeCode is the ability to read data back and easily plot it, something the web version lacks at present.
The introductory screens are identical to the web application. The interface looks nearly identical to the web version but has a couple of differences noted on the next page. © Adafruit Industries https://learn.adafruit.
See More MakeCode Projects See More MakeCode Projects (https://adafru.it/Bwv) © Adafruit Industries https://learn.adafruit.
What is CircuitPython? CircuitPython is a programming language designed to simplify experimenting and learning to program on low-cost microcontroller boards. It makes getting started easier than ever with no upfront desktop downloads needed. Once you get your board set up, open any text editor, and get started editing code. It's that simple. CircuitPython is based on Python Python is the fastest growing programming language. It's taught in schools and universities.
You're new to programming. CircuitPython is designed with education in mind. It's easy to start learning how to program and you get immediate feedback from the board. Easily update your code. Since your code lives on the disk drive, you can edit it whenever you like, you can also keep multiple files around for easy experimentation. The serial console and REPL. These allow for live feedback from your code and interactive programming. File storage.
CircuitPython As we continue to develop CircuitPython and create new releases, we will stop supporting older releases. If you are running CircuitPython 2.x, you need to update to 3.x: https://learn.adafruit.com/welcome-tocircuitpython/installing-circuitpython Install or update CircuitPython! Follow this quick step-by-step for super-fast Python power :) https://adafru.it/vlF https://adafru.
Plug your Circuit Playground Express into your computer using a known-good USB cable A lot of people end up using charge-only USB cables and it is very frustrating! So make sure you have a USB cable you know is good for data sync Double-click the small Reset button in the middle of the CPX, you will see all of the LEDs turn green. If they turn all red, check the USB cable, try another USB port, etc. (If double-clicking doesn't do it, try a single-click!) © Adafruit Industries https://learn.adafruit.
You will see a new disk drive appear called CPLAYBOOT Drag the adafruit-circuitpython-etc...uf2 file onto it The CPLAYBOOT drive will disappear and a new disk drive will appear called CIRCUITPY That's it! You're done :) Further Information For more detailed info on installing CircuitPython, check out Installing CircuitPython (https://adafru.it/Amd). © Adafruit Industries https://learn.adafruit.
Installing Mu Editor Mu is a simple code editor that works with the Adafruit CircuitPython boards. It's written in Python and works on Windows, MacOS, Linux and Raspberry Pi.
The first time you start Mu, you will be prompted to select your 'mode' - you can always change your mind later. For now please select Adafruit! The current mode is displayed in the lower right corner of the window, next to the "gear" icon. If the mode says "Microbit" or something else, click on that and then choose "Adafruit" in the dialog box that appears.
Mu Packages Mu is currently being developed. So there are lots of changes being made! Current versions are available from links at the bottom of this page (https://adafru.it/Be5). However, use at your own risk! These are not stable versions and come with no guarantees of working. © Adafruit Industries https://learn.adafruit.
Creating and Editing Code One of the best things about CircuitPython is how simple it is to get code up and running. In this section, we're going to cover how to create and edit your first CircuitPython program. To create and edit code, all you'll need is an editor. There are many options.
It will look like this - note that under the while True: line, the next four lines have spaces to indent them, but they're indented exactly the same amount. All other lines have no spaces before the text. Save this file as code.py on your CIRCUITPY drive. On each board you'll find a tiny red LED. It should now be blinking. Once per second © Adafruit Industries https://learn.adafruit.
Congratulations, you've just run your first CircuitPython program! Editing Code To edit code, open the code.py file on your CIRCUITPY drive into your editor. Make the desired changes to your code. Save the file. That's it! Your code changes are run as soon as the file is done saving. There's just one warning we have to give you before we continue... Don't Click Reset or Unplug! The CircuitPython code on your board detects when the files are changed or written and will automatically re-start your code.
Recommended only with particular settings or with add-ons: The PyCharm IDE (https://adafru.it/xNC) is safe if "Safe Write" is turned on in Settings->System Settings>Synchronization (true by default). If you are using Atom (https://adafru.it/fMG), install this package (https://adafru.it/Be8) so that it will always write out all changes to files on CIRCUITPY . SlickEdit (https://adafru.it/DdP) works only if you add a macro to flush the disk (https://adafru.it/ven).
import board import digitalio import time led = digitalio.DigitalInOut(board.D13) led.direction = digitalio.Direction.OUTPUT while True: led.value = True time.sleep(0.5) led.value = False time.sleep(0.5) Imports & Libraries Each CircuitPython program you run needs to have a lot of information to work. The reason CircuitPython is so simple to use is that most of that information is stored in other files and works in the background. These files are called libraries. Some of them are built into CircuitPython.
while True: led.value = True time.sleep(0.5) led.value = False time.sleep(0.5) First, we have led.value = True . This line tells the LED to turn on. On the next line, we have time.sleep(0.5) . This line is telling CircuitPython to pause running code for 0.5 seconds. Since this is between turning the led on and off, the led will be on for 0.5 seconds. The next two lines are similar. led.value = False tells the LED to turn off, and time.sleep(0.5) tells CircuitPython to pause for another 0.5 seconds.
Connecting to the Serial Console One of the staples of CircuitPython (and programming in general!) is something called a "print statement". This is a line you include in your code that causes your code to output text. A print statement in CircuitPython looks like this: print("Hello, world!") This line would result in: Hello, world! However, these print statements need somewhere to display.
Once in Mu, look for the Serial button in the menu and click it. Using Something Else? If you're not using Mu to edit, are using ESP8266 or nRF52 CircuitPython, or if for some reason you are not a fan of the built in serial console, you can run the serial console as a separate program. Windows requires you to download a terminal program, check out this page for more details (https://adafru.
Interacting with the Serial Console Once you've successfully connected to the serial console, it's time to start using it. The code you wrote earlier has no output to the serial console. So, we're going to edit it to create some output. Open your code.py file into your editor, and include a print statement. You can print anything you like! Just include your phrase between the quotation marks inside the parentheses. For example: import board import digitalio import time led = digitalio.DigitalInOut(board.
The Traceback (most recent call last): is telling you the last thing your board was doing before you saved your file. This is normal behavior and will happen every time the board resets. This is really handy for troubleshooting. Let's introduce an error so we can see how it is used. Delete the e at the end of True from the line led.value = True so that it says led.value = Tru Save your file. You will notice that your red LED will stop blinking, and you may have a colored status LED blinking at you.
The Traceback (most recent call last): is telling you that the last thing it was able to run was line 10 in your code. The next line is your error: NameError: name 'Tru' is not defined . This error might not mean a lot to you, but combined with knowing the issue is on line 10, it gives you a great place to start! Go back to your code, and take a look at line 10. Obviously, you know what the problem is already. But if you didn't, you'd want to look at line 10 and see if you could figure it out.
The REPL The other feature of the serial connection is the Read-Evaluate-Print-Loop, or REPL. The REPL allows you to enter individual lines of code and have them run immediately. It's really handy if you're running into trouble with a particular program and can't figure out why. It's interactive so it's great for testing new ideas. To use the REPL, you first need to be connected to the serial console. Once that connection has been established, you'll want to press Ctrl + C.
If you have trouble getting to the >>> prompt, try pressing Ctrl + C a few more times. The first thing you get from the REPL is information about your board. This line tells you the version of CircuitPython you're using and when it was released. Next, it gives you the type of board you're using and the type of microcontroller the board uses. Each part of this may be different for your board depending on the versions you're working with. This is followed by the CircuitPython prompt.
Type help("modules") into the REPL next to the prompt, and press enter. This is a list of all the core libraries built into CircuitPython. We discussed how board contains all of the pins on the board that you can use in your code. From the REPL, you are able to see that list! Type import board into the REPL and press enter. It'll go to a new prompt.
This is a list of all of the pins on your board that are available for you to use in your code. Each board's list will differ slightly depending on the number of pins available. Do you see D13 ? That's the pin you used to blink the red LED! The REPL can also be used to run code. Be aware that any code you enter into the REPL isn't saved anywhere.
© Adafruit Industries https://learn.adafruit.
CircuitPython Libraries As we continue to develop CircuitPython and create new releases, we will stop supporting older releases. If you are running CircuitPython 2.x, you need to update to 3.x. You must download the CircuitPython Library Bundle that matches your version of CircuitPython. Please update to CircuitPython 3.x and then download the 3.x bundle. Each CircuitPython program you run needs to have a lot of information to work.
full library bundle. Instead, you can find example code in the guides for your board that depends on external libraries. Some of these libraries may be available from us at Adafruit, some may be written by community members! Either way, as you start to explore CircuitPython, you'll want to know how to get libraries on board. You can grab the latest Adafruit CircuitPython 3.x Bundle release by clicking this button: https://adafru.it/y8E https://adafru.
Express Boards If you are using a Feather M0 Express, Metro M0 Express or Circuit Playground Express (or any other "Express" board) your CircuitPython board comes with at least 2 MB of Flash storage. This is plenty of space for all of our library files so we recommend you just install them all! (If you have a Gemma M0 or Trinket M0 or other non-Express board, skip down to the next section) On Express boards, the lib and examples directories can be copied directly to the CIRCUITPY drive.
Let's use a modified version of the blinky example. import board import time import simpleio led = simpleio.DigitalOut(board.D13) while True: led.value = True time.sleep(0.5) led.value = False time.sleep(0.5) Save this file. Nothing happens to your board. Let's check the serial console to see what's going on. We have an ImportError . It says there is no module named 'simpleio' . That's the one we just included in our code! Click the link above to download the correct bundle.
If you have a Trinket M0 or Gemma M0, you'll want to follow the same steps in the example above to install libraries as you need them. You don't always need to wait for an ImportError as you probably know what library you added to your code. Simply open the lib folder you downloaded, find the library you need, and drag it to the lib folder on your CIRCUITPY drive. For these boards, your internal storage is from the chip itself. So, these boards don't have enough space for all of the libraries.
Troubleshooting From time to time, you will run into issues when working with CircuitPython. Here are a few things you may encounter and how to resolve them. As we continue to develop CircuitPython and create new releases, we will stop supporting older releases. If you are running CircuitPython 2.x, you need to update to 3.x. You must download the CircuitPython Library Bundle that matches your version of CircuitPython. Please update to CircuitPython 3.x and then download the 3.x bundle.
everything named "Windows Driver Package - Adafruit Industries LLC ...". Now install the new 2.3.0.0 (or higher) Adafruit Windows Drivers Package: https://adafru.it/AB0 https://adafru.it/AB0 When running the installer, you'll be shown a list of drivers to choose from. You can check and uncheck the boxes to choose which drivers to install. You should now be done! Test by unplugging and replugging the board.
and released a beta version that fixes the problem. This may have been incorporated into the latest release. Please let us know in the forums if you test thi.s Hard Disk Sentinel Kaspersky anti-virus: To fix, you may need to disable Kaspersky completely. Disabling some aspects of Kaspersky does not always solve the problem. This problem has been reported to Kaspersky. CIRCUITPY Drive Does Not Appear Kaspersky anti-virus can block the appearance of the CIRCUITPY drive.
Circuit Playground Express does NOT have a status LED. The LEDs will pulse green when in the bootloader. They do NOT indicate any status while running CircuitPython. Here's what the colors and blinking mean: steady GREEN: code.py (or code.txt , main.py , or main.txt ) is running pulsing GREEN: code.py (etc.
You WILL lose everything on the board when you complete the following steps. If possible, make a copy of your code before continuing. Easiest Way: Use storage.erase_filesystem() Starting with version 2.3.0, CircuitPython includes a built-in function to erase and reformat the filesystem. If you have an older version of CircuitPython on your board, you can update to the newest version (https://adafru.it/Amd) to do this. 1. Connect to the CircuitPython REPL (https://adafru.
It should reboot automatically and you should see CIRCUITPY in your file explorer again. If the LED flashes red during step 5, it means the erase has failed. Repeat the steps starting with 2. If you haven't already downloaded the latest release of CircuitPython for your board, check out the installation page (https://adafru.it/Amd).
One unique feature of Python is that the indentation of code matters. Usually the recommendation is to indent code with four spaces for every indent. In general, we recommend that too. However, one trick to storing more humanreadable code is to use a single tab character for indentation. This approach uses 1/4 of the space for indentation and can be significant when we're counting bytes. Mac OSX loves to add extra files.
Once you've disabled and removed hidden files with the above commands on Mac OSX you need to be careful to copy files to the board with a special command that prevents future hidden files from being created. Unfortunately you cannot use drag and drop copy in Finder because it will still create these hidden extended attribute files in some cases (for files downloaded from the internet, like Adafruit's modules). To copy a file or folder use the -X option for the cp command in a terminal.
Whoa! We have 13Ki more than before! This space can now be used for libraries and code! © Adafruit Industries https://learn.adafruit.
Uninstalling CircuitPython A lot of our boards can be used with multiple programming languages. For example, the Circuit Playground Express can be used with MakeCode, Code.org CS Discoveries, CircuitPython and Arduino.
Your MakeCode is now running and CircuitPython has been removed. Going forward you only have to single click the reset button Moving to Arduino If you want to change your firmware to Arduino, it's also pretty easy. Start by plugging in your board, and double-clicking reset until you get the green onboard LED(s) - just like with MakeCode Within Arduino IDE, select the matching board, say Circuit Playground Express Select the correct matching Port: © Adafruit Industries https://learn.adafruit.
Create a new simple Blink sketch example: // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 13 as an output.
Welcome to the Community! CircuitPython is a programming language that's super simple to get started with and great for learning. It runs on microcontrollers and works out of the box. You can plug it in and get started with any text editor. The best part? CircuitPython comes with an amazing, supportive community. Everyone is welcome! CircuitPython is Open Source. This means it's available for anyone to use, edit, copy and improve upon.
There are many different channels so you can choose the one best suited to your needs. Each channel is shown on Discord as "#channelname". There's the #projecthelp channel for assistance with your current project or help coming up with ideas for your next one. There's the #showandtell channel for showing off your newest creation. Don't be afraid to ask a question in any channel! If you're unsure, #general is a great place to start.
Be sure to include the steps you took to get to where you are. If it involves wiring, post a picture! If your code is giving you trouble, include your code in your post! These are great ways to make sure that there's enough information to help you with your issue. You might think you're just getting started, but you definitely know something that someone else doesn't.
When working with CircuitPython, you may find problems. If you find a bug, that's great! We love bugs! Posting a detailed issue to GitHub is an invaluable way to contribute to improving CircuitPython. Be sure to include the steps to replicate the issue as well as any other information you think is relevant. The more detail, the better! Testing new software is easy and incredibly helpful. Simply load the newest version of CircuitPython or a library onto your CircuitPython hardware, and use it.
CircuitPython Playground Here are some demos showing how to use the circuit playground with python! © Adafruit Industries https://learn.adafruit.
CircuitPython Built-Ins CircuitPython comes 'with the kitchen sink' - a lot of the things you know and love about classic Python 3 (sometimes called CPython) already work. There are a few things that don't but we'll try to keep this list updated as we add more capabilities! This is not an exhaustive list! It's simply some of the many features you can use. Thing That Are Built In and Work Flow Control All the usual if , elif , else , for , while work just as expected.
CircuitPython Digital In & Out The first part of interfacing with hardware is being able to manage digital inputs and outputs. With Circuitpython it's super easy! This quick-start example shows how you can use one of the Circuit Playground Express buttons as an input to control another digital output - the built in LED Copy and paste the code block into code.
We're using the built-in pushbuttons in this example because it's very easy to get started, but you can use ALL KINDS of different buttons and switches, even homemade ones such as tinfoil or pennies, as digital inputs connected to the Digital IO pads! Note that we made the code a little less 'pythonic' than necessary, the if/then could be replaced with a simple led.value = not button.value but I wanted to make it super clear how to test the inputs. When the interpreter gets to evaluating button.
Try testing the slide switch instead of the buttons. For the slide switch you need to use Pull.UP instead of Pull.DOWN. Hints: switch = DigitalInOut(board.SLIDE_SWITCH) switch.direction = Direction.INPUT switch.pull = Pull.UP switch = DigitalInOut(board.SLIDE_SWITCH) switch.direction = Direction.INPUT if switch.value is True: # switch is slid to the left switch.pull = Pull.UP if switch.value is True: # switch is slid to the left © Adafruit Industries https://learn.adafruit.
CircuitPython Analog In This quick-start example shows how you can read the analog voltage of a potentiometer connected to the Circuit Playground Express. First, connect your potentiometer to the Circuit Playground Express using three alligator clip leads, as shown. The connections are: Left pot connection to 3.3V Center pot (wiper) to A1 Right pot connection to GND When you turn the knob of the potentiometer, the wiper rotates left and right, increasing or decreasing the resistance.
# # # # CircuitPlaygroundExpress_AnalogIn reads the analog voltage level from a 10k potentiometer connected to GND, 3.3V, and pin A1 and prints the results to the REPL import time import board from analogio import AnalogIn analogin = AnalogIn(board.A1) def getVoltage(pin): # helper return (pin.value * 3.3) / 65536 while True: print("Analog Voltage: %f" % getVoltage(analogin)) time.sleep(0.1) Creating an Analog Input analogin = AnalogIn(board.
© Adafruit Industries https://learn.adafruit.
CircuitPython Analog Out This example shows you how you can set the DAC (true analog output) on pin A0. A0 is the only true analog output on the M0 boards. No other pins do true analog output! Copy and paste the code into code.py using your favorite editor, and save the file. # CircuitPython IO demo - analog output import board from analogio import AnalogOut analog_out = AnalogOut(board.
Check out the Audio Out section of this guide (https://adafru.it/BRj) for examples! Find the pin Use the diagrams below to find the A0 pin marked with a magenta arrow! Circuit Playground Express A0 is located between VOUT and A1 near the battery port. Trinket M0 A0 is labeled "1~" on Trinket! A0 is located between "0" and "2" towards the middle of the board on the same side as the red LED. © Adafruit Industries https://learn.adafruit.
Gemma M0 A0 is located in the middle of the right side of the board next to the On/Off switch. Feather M0 Express A0 is located between GND and A1 on the opposite side of the board from the battery connector, towards the end with the Reset button.
ItsyBitsy M0 Express A0 is located between VHI and A1, near the "A" in "Adafruit", and the pin pad has left and right white parenthesis markings around it. ItsyBitsy M4 Express A0 is located between VHI and A1, and the pin pad has left and right white parenthesis markings around it. Metro M0 Express A0 is between VIN and A1, and is located along the same side of the board as the barrel jack adapter towards the middle of the headers found on that side of the board. © Adafruit Industries https://learn.
Metro M4 Express A0 is between VIN and A1, and is located along the same side of the board as the barrel jack adapter towards the middle of the headers found on that side of the board. On the Metro M4 Express, there are TWO true analog outputs: A0 and A1. © Adafruit Industries https://learn.adafruit.
CircuitPython PWM Your board has pulseio support, which means you can PWM LEDs, control servos, beep piezos, and manage "pulse train" type devices like DHT22 and Infrared. Nearly every pin has PWM support! For example, all ATSAMD21 board have an A0 pin which is 'true' analog out and does not have PWM support. PWM with Fixed Frequency This example will show you how to use PWM to fade the little red LED on your board. Copy and paste the code into code.py using your favorite editor, and save the file.
To use with the Metro M4 Express, ItsyBitsy M4 Express or the Feather M4 Express, you must comment out the piezo = pulseio.PWMOut(board.A2, duty_cycle=0, frequency=440, variable_frequency=True) line and uncomment the piezo = pulseio.PWMOut(board.A1, duty_cycle=0, frequency=440, variable_frequency=True) line. A2 is not a supported PWM pin on the M4 boards! Remember: To "comment out" a line, put a # and a space before it. To "uncomment" a line, remove the # + space from the beginning of the line.
Wire it up Use the diagrams below to help you wire up your piezo. Attach one leg of the piezo to pin A2 on the M0 boards or A1 on the M4 boards, and the other leg to ground. It doesn't matter which leg is connected to which pin. They're interchangeable! Circuit Playground Express Use alligator clips to attach A2 and any one of the GND to different legs of the piezo.
Gemma M0 Use alligator clips to attach A2 and GND to different legs on the piezo. Gemma has PWM available on the following pins: A1, D2, RX, SCL, A2, D0, TX, SDA, L, D13, APA102_MOSI, APA102_SCK. There is NO PWM on: A0, D1. Feather M0 Express Use jumper wires to attach A2 and one of the two GND to different legs of the piezo. Feather M0 Express has PWM on the following pins: A2, A3, A4, SCK, MOSI, MISO, D0, RX, D1, TX, SDA, SCL, D5, D6, D9, D10, D11, D12, D13, NEOPIXEL.
ItsyBitsy M0 Express Use jumper wires to attach A2 and G to different legs of the piezo. ItsyBitsy M0 Express has PWM on the following pins: D0, RX, D1, TX, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, L, A2, A3, A4, MOSI, MISO, SCK, SCL, SDA, APA102_MOSI, APA102_SCK. There is NO PWM on: A0, A1, A5. ItsyBitsy M4 Express Use jumper wires to attach A1 and G to different legs of the piezo. To use A1, comment out the current pin setup line, and uncomment the line labeled for the M4 boards.
Metro M4 Express Use jumper wires to connect A1 and any one of the GND to different legs on the piezo. To use A1, comment out the current pin setup line, and uncomment the line labeled for the M4 boards. See the details above! Metro M4 Express has PWM on: A1, A5, D0, RX, D1, TX, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, SDA, SCK, MOSI, MISO There is No PWM on: A0, A2, A3, A4, SCL, AREF, NEOPIXEL, LED_RX, LED_TX.
CircuitPython Servo In order to use servos, we take advantage of pulseio . Now, in theory, you could just use the raw pulseio calls to set the frequency to 50 Hz and then set the pulse widths. But we would rather make it a little more elegant and easy! So, instead we will use adafruit_motor which manages servos for you quite nicely! adafruit_motor is a library so be sure to grab it from the library bundle if you have not yet (https://adafru.
For Gemma, use jumper wire alligator clips to connect the ground wire to GND, the power wire to VOUT, and the signal wire to A2. For Circuit Playground Express, use jumper wire alligator clips to connect the ground wire to GND, the power wire to VOUT, and the signal wire to A2. For boards like Feather M0 Express, ItsyBitsy M0 Express and Metro M0 Express, connect the ground wire to any GND, the power wire to USB or 5V, and the signal wire to A2. © Adafruit Industries https://learn.adafruit.
For the Metro M4 Express, ItsyBitsy M4 Express and the Feather M4 Express, connect the ground wire to any G or GND, the power wire to USB or 5V, and the signal wire to A1. Servo Code Here's an example that will sweep a servo connected to pin A2 from 0 degrees to 180 degrees and back: import time import board import pulseio from adafruit_motor import servo # create a PWMOut object on Pin A2. pwm = pulseio.PWMOut(board.A2, duty_cycle=2 ** 15, frequency=50) # Create a servo object, my_servo. my_servo = servo.
CircuitPython Audio Out The Audio library in CircuitPython has changed from 2.x to 3.x, this guide is for 3.x and above only so please upgrade your CPX! The Circuit Playground Express has some nice built in audio output capabilities. There are two ways to get audio output, one is via the small built in speaker. The other is by using alligator clips to connect a headphone or powered speaker to the A0 pin.
Basic Tones We can start by making simple tones. We will play sine waves. We first generate a single period of a sine wave in python, with the math.sin function, and stick it into sine_wave . Then we enable the speaker by setting the SPEAKER_ENABLE pin to be an output and True . We can create the audio object with this line that sets the output pin and the sine wave sample object and give it the sample array audio = audioio.AudioOut(board.SPEAKER) sine_wave_sample = audioio.
https://adafru.it/zFK https://adafru.it/zFL https://adafru.it/zFL Click to download, and save them onto your CIRCUITPY drive, alongside your main.py and lib files This is the example code we'll be using © Adafruit Industries https://learn.adafruit.
import audioio import board import digitalio # enable the speaker spkrenable = digitalio.DigitalInOut(board.SPEAKER_ENABLE) spkrenable.direction = digitalio.Direction.OUTPUT spkrenable.value = True # make the 2 input buttons buttonA = digitalio.DigitalInOut(board.BUTTON_A) buttonA.direction = digitalio.Direction.INPUT buttonA.pull = digitalio.Pull.DOWN buttonB = digitalio.DigitalInOut(board.BUTTON_B) buttonB.direction = digitalio.Direction.INPUT buttonB.pull = digitalio.Pull.
© Adafruit Industries https://learn.adafruit.
CircuitPython Cap Touch This quick-start example shows how you can read the capacitive touch sensors built into on seven of the CIrcuit Playground Express pads (pad A0 is not a capacitive touch pad). Copy and paste the code block into code.py using your favorite text editor, and save the file, to run the demo © Adafruit Industries https://learn.adafruit.
# CircuitPlaygroundExpress_CapTouch import time import board import touchio touch1 touch2 touch3 touch4 touch5 touch6 touch7 = = = = = = = touchio.TouchIn(board.A1) touchio.TouchIn(board.A2) touchio.TouchIn(board.A3) touchio.TouchIn(board.A4) touchio.TouchIn(board.A5) touchio.TouchIn(board.A6) touchio.TouchIn(board.A7) while True: if touch1.value: print("A1 touched!") if touch2.value: print("A2 touched!") if touch3.value: print("A3 touched!") if touch4.value: print("A4 touched!") if touch5.
seconds to 0 seconds to slow it down or speed it up. Note that no extra hardware is required, you can touch the pads directly, but you may want to attach alligator clips or foil tape to metallic or conductive objects. Try silverware, fruit or other food, liquid, aluminum foil, and items around your desk! © Adafruit Industries https://learn.adafruit.
You may need to restart your code/board after changing the attached item because the capacitive touch code 'calibrates' based on what it sees when it first starts up. So if you get too many touch-signals or not enough, hit that reset button! Copper Foil Tape with Conductive Adhesive - 6mm x 15 meter roll $5.95 IN STOCK ADD TO CART Copper Foil Tape with Conductive Adhesive - 25mm x 15 meter roll $19.95 IN STOCK ADD TO CART Small Alligator Clip Test Lead (set of 12) $3.
CircuitPython NeoPixel NeoPixels are a revolutionary and ultra-popular way to add lights and color to your project. These stranded RGB lights have the controller inside the LED, so you just push the RGB data and the LEDs do all the work for you! They're a perfect match for CircuitPython. You can drive 300 pixels with brightness control and 1000 pixels without (set brightness=1.0 in object creation). That's because to adjust the brighness we have to dynamically re-create the datastream each write.
# The colours are a transition r - g - b - back to r. if pos < 85: return (int(pos * 3), int(255 - (pos * 3)), 0) elif pos < 170: pos -= 85 return (int(255 - (pos * 3)), 0, int(pos * 3)) else: pos -= 170 return (0, int(pos * 3), int(255 - pos * 3)) def rainbow_cycle(wait): for j in range(255): for i in range(len(pixels)): idx = int((i * 256 / len(pixels)) + j * 10) pixels[i] = wheel(idx & 255) pixels.show() time.
pixels[i] = BLUE time.sleep(wait) time.sleep(1) for i in range(len(pixels)): pixels[i] = PURPLE time.sleep(wait) time.sleep(1) for i in range(len(pixels)): pixels[i] = BLACK time.sleep(wait) time.sleep(1) while True: if simpleCircleDemo: print('Simple Circle Demo') simpleCircle(.05) if flashDemo: # this will play if flashDemo = 1 up above print('Flash Demo') pixels.fill((255, 0, 0)) pixels.show() time.sleep(.25) pixels.fill((0, 255, 0)) pixels.show() time.sleep(.25) pixels.fill((0, 0, 255)) pixels.
set to True, where every change is immediately written to the strip of pixels, this is easier to use but way slower. if you set auto_write=False then you will have to call strip.show() when you want to actually write color data out. You can easily set colors by indexing into the location strip[n] = (red, green, blue) . For example, strip[0] = (100, 0, 0) will set the first pixel to a medium-brightness red, and strip[2] = (0, 255, 0) will set the third pixel to bright green.
CircuitPython DotStar DotStars use two wires, unlike NeoPixel's one wire. They're very similar but you can write to DotStars much faster with hardware SPI and they have a faster PWM cycle so they are better for light painting. Any pins can be used but if the two pins can form a hardware SPI port, the library will automatically switch over to hardware SPI. If you use hardware SPI then you'll get 4 MHz clock rate (that would mean updating a 64 pixel strand in about 500uS - that's 0.0005 seconds).
Note that the wire ordering on your DotStar strip or shape may not exactly match the diagram above. Check the markings to verify which pin is DIN, CIN, 5V and GND The Code This example includes multiple visual effects. Copy and paste the code into code.py using your favorite editor, and save the file. # CircuitPython demo - Dotstar import time import adafruit_dotstar import board num_pixels = 30 pixels = adafruit_dotstar.DotStar(board.A1, board.A2, num_pixels, brightness=0.
time.sleep(wait) pixels[::2] = [YELLOW] * (num_pixels // 2) pixels.show() time.sleep(wait) pixels[1::2] = [GREEN] * (num_pixels // 2) pixels.show() time.sleep(wait) pixels[::2] = [TEAL] * (num_pixels // 2) pixels.show() time.sleep(wait) pixels[1::2] = [CYAN] * (num_pixels // 2) pixels.show() time.sleep(wait) pixels[::2] = [BLUE] * (num_pixels // 2) pixels.show() time.sleep(wait) pixels[1::2] = [PURPLE] * (num_pixels // 2) pixels.show() time.sleep(wait) pixels[::2] = [MAGENTA] * (num_pixels // 2) pixels.
ORANGE = (255, 40, 0) GREEN = (0, 255, 0) TEAL = (0, 255, 120) CYAN = (0, 255, 255) BLUE = (0, 0, 255) PURPLE = (180, 0, 255) MAGENTA = (255, 0, 20) WHITE = (255, 255, 255) while True: # Change this number to change how long it stays on each solid color. color_fill(RED, 0.5) color_fill(YELLOW, 0.5) color_fill(ORANGE, 0.5) color_fill(GREEN, 0.5) color_fill(TEAL, 0.5) color_fill(CYAN, 0.5) color_fill(BLUE, 0.5) color_fill(PURPLE, 0.5) color_fill(MAGENTA, 0.5) color_fill(WHITE, 0.
your pixels. This makes your code more complicated, but it can make your LED animations faster! DotStar Helpers We've included a few helper functions to create the super fun visual effects found in this code. First is wheel() which we just learned with the Internal RGB LED (https://adafru.it/Bel). Then we have color_fill() which requires you to provide a color and the length of time you'd like it to be displayed.
import board import busio def is_hardware_spi(clock_pin, data_pin): try: p = busio.SPI(clock_pin, data_pin) p.deinit() return True except ValueError: return False # Provide the two pins you intend to use. if is_hardware_spi(board.A1, board.A2): print("This pin combination is hardware SPI!") else: print("This pin combination isn't hardware SPI.") Read the Docs For a more in depth look at what dotstar can do, check out DotStar on Read the Docs (https://adafru.it/C4d). © Adafruit Industries https://learn.
CircuitPython UART Serial In addition to the USB-serial connection you use for the REPL, there is also a hardware UART you can use. This is handy to talk to UART devices like GPSs, some sensors, or other microcontrollers! This quick-start example shows how you can create a UART device for communicating with hardware serial devices. To use this example, you'll need something to generate the UART data. We've used a GPS! Note that the GPS will give you UART data without getting a fix on your location.
The data that is returned is in a byte array, if you want to convert it to a string, you can use this handy line of code which will run chr() on each byte: datastr = ''.join([chr(b) for b in data]) # convert bytearray to string Your results will look something like this: For more information about the data you're reading and the Ultimate GPS, check out the Ultimate GPS guide: https://learn.adafruit.com/adafruit-ultimate-gps Wire It Up You'll need a couple of things to connect the GPS to your board.
Check out the list below for a diagram of your specific board! Watch out! A common mixup with UART serial is that RX on one board connects to TX on the other! However, sometimes boards have RX labeled TX and vice versa. So, you'll want to start with RX connected to TX, but if that doesn't work, try the other way around! Circuit Playground Express Connect 3.3v on your CPX to 3.3v on your GPS. Connect GND on your CPX to GND on your GPS. Connect RX/A6 on your CPX to TX on your GPS.
Gemma M0 Connect 3vo on the Gemma to 3.3v on the GPS. Connect GND on the Gemma to GND on the GPS. Connect A1/D2 on the Gemma to TX on the GPS. Connect A2/D0 on the Gemma to RX on the GPS. Feather M0 Express and Feather M4 Express Connect USB on the Feather to VIN on the GPS. Connect GND on the Feather to GND on the GPS. Connect RX on the Feather to TX on the GPS. Connect TX on the Feather to RX on the GPS. © Adafruit Industries https://learn.adafruit.
ItsyBitsy M0 Express and ItsyBitsy M4 Express Connect USB on the ItsyBitsy to VIN on the GPS Connect G on the ItsyBitsy to GND on the GPS. Connect RX/0 on the ItsyBitsy to TX on the GPS. Connect TX/1 on the ItsyBitsy to RX on the GPS. Metro M0 Express and Metro M4 Express Connect 5V on the Metro to VIN on the GPS. Connect GND on the Metro to GND on the GPS. Connect RX/D0 on the Metro to TX on the GPS. Connect TX/D1 on the Metro to RX on the GPS.
import board import busio from microcontroller import Pin def is_hardware_uart(tx, rx): try: p = busio.UART(tx, rx) p.deinit() return True except ValueError: return False def get_unique_pins(): exclude = ['NEOPIXEL', 'APA102_MOSI', 'APA102_SCK'] pins = [pin for pin in [ getattr(board, p) for p in dir(board) if p not in exclude] if isinstance(pin, Pin)] unique = [] for p in pins: if p not in unique: unique.
>>> import board,busio >>> i2c = busio.I2C(board.SCL, board.SDA) >>> uart = busio.UART(board.TX, board.RX) Traceback (most recent call last): File "", line 1, in ValueError: Invalid pins © Adafruit Industries https://learn.adafruit.
CircuitPython I2C I2C is a 2-wire protocol for communicating with simple sensors and devices, meaning it uses two connections for transmitting and receiving data. There are many I2C devices available and they're really easy to use with CircuitPython. We have libraries available for many I2C devices in the library bundle (https://adafru.it/uap).
Circuit Playground Express Connect 3.3v on your CPX to 3.3v on your TSL2561. Connect GND on your CPX to GND on your TSL2561. Connect SCL/A4 on your CPX to SCL on your TSL2561. Connect SDL/A5 on your CPX to SDA on your TSL2561. Trinket M0 Connect USB on the Trinket to VIN on the TSL2561. Connect Gnd on the Trinket to GND on the TSL2561. Connect D2 on the Trinket to SCL on the TSL2561. Connect D0 on the Trinket to SDA on the TSL2561. Gemma M0 Connect 3vo on the Gemma to 3V on the TSL2561.
Feather M0 Express and Feather M4 Express Connect USB on the Feather to VIN on the TSL2561. Connect GND on the Feather to GND on the TSL2561. Connect SCL on the Feather to SCL on the TSL2561. Connect SDA on the Feather to SDA on the TSL2561. ItsyBitsy M0 Express and ItsyBitsy M4 Express Connect USB on the ItsyBitsy to VIN on the TSL2561 Connect G on the ItsyBitsy to GND on the TSL2561. Connect SCL on the ItsyBitsy to SCL on the TSL2561. Connect SDA on the ItsyBitsy to SDA on the TSL2561.
Metro M0 Express and Metro M4 Express Connect 5V on the Metro to VIN on the TSL2561. Connect GND on the Metro to GND on the TSL2561. Connect SCL on the Metro to SCL on the TSL2561. Connect SDA on the Metro to SDA on the TSL2561. Find Your Sensor The first thing you'll want to do after getting the sensor wired up, is make sure it's wired correctly. We're going to do an I2C scan to see if the board is detected, and if it is, print out its I2C address. Copy and paste the code into code.
i2c.scan()] . Open the serial console to see the results! The code prints out an array of addresses. We've connected the TSL2561 which has a 7-bit I2C address of 0x39. The result for this sensor is I2C addresses found: ['0x39'] . If no addresses are returned, refer back to the wiring diagrams to make sure you've wired up your sensor correctly. I2C Sensor Data Now we know for certain that our sensor is connected and ready to go.
Where's my I2C? On the SAMD21, we have the flexibility of using a wide range of pins for I2C. Some chips, like the ESP8266 can use any pins for I2C, using bitbangio. There's some other chips that may have fixed I2C pin. The good news is you can use many but not all pins. Given the large number of SAMD boards we have, its impossible to guarantee anything other than the labeled 'SDA' and 'SCL'.
import board import busio from microcontroller import Pin def is_hardware_I2C(scl, sda): try: p = busio.I2C(scl, sda) p.deinit() return True except ValueError: return False except RuntimeError: return True def get_unique_pins(): exclude = ['NEOPIXEL', 'APA102_MOSI', 'APA102_SCK'] pins = [pin for pin in [ getattr(board, p) for p in dir(board) if p not in exclude] if isinstance(pin, Pin)] unique = [] for p in pins: if p not in unique: unique.
CircuitPython HID Keyboard One of the things we baked into CircuitPython is 'HID' control - Keyboard and Mouse capabilities. This means a Circuit Playground Express can act like a keyboard device and press keys, or a mouse and have it move the mouse around and press buttons.
# make all pin objects, make them inputs w/pulldowns for pin in buttonpins: button = DigitalInOut(pin) button.direction = Direction.INPUT button.pull = Pull.DOWN buttons.append(button) led = DigitalInOut(board.D13) led.direction = Direction.OUTPUT print("Waiting for button presses") while True: # check each button # when pressed, the LED will light up, # when released, the keycode or string will be sent # this prevents rapid-fire repeats! for button in buttons: if button.value: # pressed? i = buttons.
For more detail check out the documentation at https://circuitpython.readthedocs.io/projects/hid/en/latest/ © Adafruit Industries https://learn.adafruit.
CircuitPython HID Keyboard and Mouse One of the things we baked into CircuitPython is 'HID' (Human Interface Device) control - that means keyboard and mouse capabilities. This means your CircuitPython board can act like a keyboard device and press key commands, or a mouse and have it move the mouse pointer around and press buttons.
while True: # Check each pin for key_pin in key_pin_array: if not key_pin.value: # Is it grounded? i = key_pin_array.index(key_pin) print("Pin #%d is grounded." % i) # Turn on the red LED led.value = True while not key_pin.value: pass # Wait for it to be ungrounded! # "Type" the Keycode or string key = keys_pressed[i] # Get the corresponding Keycode or string if isinstance(key, str): # If it's a string... keyboard_layout.write(key) # ...Print the string else: # If it's not a string... keyboard.
submit a GitHub pull request!). The time.sleep(1) avoids an error that can happen if the program gets run as soon as the board gets plugged in, before the host computer finishes connecting to the board. Then we take the pins we chose above, and create the pin objects, set the direction and give them each a pullup. Then we apply the pin objects to key_pin_array so we can use them later. Next we set up the little red LED to so we can use it as a status light.
def steps(axis): """ Maps the potentiometer voltage range to 0-20 """ return round((axis - pot_min) / step) while True: x = get_voltage(x_axis) y = get_voltage(y_axis) if select.value is False: mouse.click(Mouse.LEFT_BUTTON) time.sleep(0.2) # Debounce delay if steps(x) > 11.0: # print(steps(x)) mouse.move(x=1) if steps(x) < 9.0: # print(steps(x)) mouse.move(x=-1) if steps(x) > 19.0: # print(steps(x)) mouse.move(x=8) if steps(x) < 1.0: # print(steps(x)) mouse.move(x=-8) if steps(y) > 11.
To use this demo, simply move the joystick around. The mouse will move slowly if you move the joystick a little off center, and more quickly if you move it as far as it goes. Press down on the joystick to click the mouse. Awesome! Now let's take a look at the code. Create the Objects and Variables First we create the mouse object. Next, we set x_axis and y_axis to pins A0 and A1 . Then we set select to A2 , set it as input and give it a pullup. The x and y axis on the joystick act like 2 potentiometers.
Next, we check to see when the state of the select button is False . It defaults to True when it is not pressed, so if the state is False , the button has been pressed. When it's pressed, it sends the command to click the left mouse button. The time.sleep(0.2) prevents it from reading multiple clicks when you've only clicked once. Then we use the steps() function to set our mouse movement. There are two sets of two if statements for each axis.
CircuitPython CPU Temp There is a CPU temperature sensor built into every ATSAMD21 chip. CircuitPython makes it really simple to read the data from this sensor. This works on the M0, M0 Express and Circuit Playground Express boards, because it's built into the microcontroller used for these boards. It does not work on the ESP8266 as this uses a different chip. The data is read using two simple commands. We're going to enter them in the REPL. Plug in your board, connect to the serial console (https://adafru.
CircuitPython Storage CircuitPython boards show up as as USB drive, allowing you to edit code directly on the board. You've been doing this for a while. By now, maybe you've wondered, "Can I write data from CircuitPython to the storage drive to act as a datalogger?" The answer is yes! However, it is a little tricky. You need to add some special code to boot.py, not just code.py.
import time import board import digitalio import microcontroller led = digitalio.DigitalInOut(board.D13) led.switch_to_output() try: with open("/temperature.txt", "a") as fp: while True: temp = microcontroller.cpu.temperature # do the C-to-F conversion here if you would like fp.write('{0:f}\n'.format(temp)) fp.flush() led.value = not led.value time.sleep(1) except OSError as e: delay = 0.5 if e.args[0] == 28: delay = 0.25 while True: led.value = not led.value time.
boot.py only runs on first boot of the device, not if you re-load the serial console with ctrl+D or if you save a file. You must EJECT the USB drive, then physically press the reset button! Once you copied the files to your board, eject it and unplug it from your computer. If you're using your Circuit Playground Express, all you have to do is make sure the switch is to the right. Otherwise, use alligator clips or jumper wires to connect the chosen pin to ground.
This file gets updated once per second, but you won't see data come in live. Instead, when you're ready to grab the data, eject and unplug your board. For CPX, move the switch to the left, otherwise remove the wire connecting the pin to ground. Now it will be possible for you to write to the filesystem from your computer again, but it will not be logging data. We have a more detailed guide on this project available here: CPU Temperature Logging with CircuitPython. (https://adafru.
CircuitPython Expectations As we continue to develop CircuitPython and create new releases, we will stop supporting older releases. If you are running CircuitPython 2.x, you need to update to 3.x. You must download the CircuitPython Library Bundle that matches your version of CircuitPython. Please update to CircuitPython 3.x and then download the 3.x bundle.
Small Disk Space Since we use the internal flash for disk, and that's shared with runtime code, its limited! Only about 50KB of space. No Audio or NVM Part of giving up that FLASH for disk means we couldn't fit everything in. There is, at this time, no support for hardware audio playpack or NVM 'eeprom'. Modules audioio and bitbangio are not included. For that support, check out the Circuit Playground Express or other Express boards.
Frequently Asked Questions These are some of the common questions regarding CircuitPython and CircuitPython microcontrollers. What is a MemoryError ? Memory allocation errors happen when you're trying to store too much on the board. The CircuitPython microcontroller boards have a limited amount of memory available. You can have about 250 lines of code on the M0 Express boards.
Does Feather M0 support WINC1500? No, WINC1500 will not fit into the M0 flash space. Can AVRs such as ATmega328 or ATmega2560 run CircuitPython? No. Commonly Used Acronyms CP or CPy = CircuitPython (https://adafru.it/cpy-welcome) CPC = Circuit Playground Classic (https://adafru.it/ncE) CPX = Circuit Playground Express (https://adafru.it/wpF) © Adafruit Industries https://learn.adafruit.
Playground Light Sensor The Circuit Playground Express can see you! OK, not really. That would be creepy. But, it can sense light and dark, as well as colors and even your pulse!! The Light Sensor in the upper left of the board (look for the eye icon) is a phototransistor. Here's how to use it as a light sensor: © Adafruit Industries https://learn.adafruit.
# CircuitPlaygroundExpress_LightSensor # reads the on-board light sensor and graphs the brighness with NeoPixels import time import board import neopixel from analogio import AnalogIn from simpleio import map_range pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, auto_write=0, brightness=.05) pixels.fill((0, 0, 0)) pixels.show() analogin = AnalogIn(board.LIGHT) while True: # light value remaped to pixel position peak = map_range(analogin.value, 2000, 62000, 0, 9) print(analogin.
Playground Temperature But wait! There's more -- the Circuit Playground Express can also tell the temperature! How, you ask? With a build in thermistor. This little sensor is a thermally sensitive resistor, meaning it's resistance changes based on temperature. We can access its readings in CircuitPython by importing the adafruit_thermistor library, and then using the board.TEMPERATURE pin to read the thermistor value. Copy the code below in to a new file, then save it onto the board as main.py.
© Adafruit Industries https://learn.adafruit.
Playground Drum Machine A wise man once said, "Nothing sounds better than an Eight-O-Eight." (That wise man was Adam Horovitz of the Beastie Boys.) The 808 to which Ad-Rock was referring is the Roland TR-808 drum machine. Let's build a little Circuit Playground Express tribute to the venerable 808! Instead of a full-blown drum pattern sequencer, we'll just focus on the machine's pads which are used for finger drumming to play back sampled drum sounds.
Now, it's time to code the Circuit Playground Express! Copy the code shown below, and then paste it into your text editor of choice. Save the file as main.py (or code.py) on your CIRCUITPY. © Adafruit Industries https://learn.adafruit.
# Playground 808 # Drum machine import time import audioio import board import touchio from digitalio import DigitalInOut, Direction bpm = 120 # beats per minute, change this to suit your tempo # enable the speaker spkrenable = DigitalInOut(board.SPEAKER_ENABLE) spkrenable.direction = Direction.OUTPUT spkrenable.value = True # make the input cap sense pads capPins = (board.A1, board.A2, board.A3, board.A4, board.A5, board.A6, board.A7) touchPad = [] for i in range(7): touchPad.append(touchio.
Capacitance is calibrated at startup, so you may need to reset the board after attaching leads to the pads! If you want to use your own sound files, you can! Record, sample, remix, or simply download files from a sound file sight, such as freesample.org. Then, to make sure you have the files converted to the proper specifications, check out this guide here (https://adafru.it/s8f) that'll show you how! Spoiler alert: you'll need to make a small, 22Khz (or lower), 16 bit PCM, mono .
Playground Sound Meter Use the microphone on your Circuit Playground Express to measure sound levels and display them on a VU-meter-like display! Note: This program will only work with the improved microphone support in CircuitPython 2.2.0 or later. The program is below. There are many settings that you can change to make the readings more or less sensitive and the display more or less jumpy. Try changing CURVE to be 4 or 1 or 10 or -2 and see what happens.
# # # # # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import array import math import audiobusio import board import neopixel # Exponential scaling factor. # Should probably be in range -10 .. 10 to be reasonable.
def volume_color(volume): return 200, volume * (255 // NUM_PIXELS), 0 # Main program # Set up NeoPixels and turn them all off. pixels = neopixel.NeoPixel(board.NEOPIXEL, NUM_PIXELS, brightness=0.1, auto_write=False) pixels.fill(0) pixels.show() # For CircuitPython 2.x: mic = audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, frequency=16000, bit_depth=16) # For Circuitpython 3.0 and up, "frequency" is now called "sample_rate". # Comment the lines above and uncomment the lines below.
pixels.show() © Adafruit Industries https://learn.adafruit.
Arduino Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards (https://adafru.it/oVa) are able to read inputs - light on a sensor, a finger on a button, or a Twitter message and turn it into an output - activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (https://adafru.
Set Up Arduino IDE Since the Circuit Playground Express uses an ATSAMD21 chip running at 48 MHz, you can pretty easily get it working with the Arduino IDE. Most libraries (including the popular ones like NeoPixels and display) will work with the M0, especially devices & sensors that use i2c or SPI.
Install Drivers (Windows 7 Only) When you plug in the board, you'll need to possibly install a driver Click below to download our Driver Installer https://adafru.it/zek https://adafru.it/zek Download and run the installer, more details are here (https://adafru.it/Bf7) Blink Now you can upload your first blink sketch! Plug in the Circuit Playground Express and wait for it to be recognized by the OS (just takes a few seconds).
// the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 13 as an output.
Manually bootloading Once it is in bootloader mode, you can select the newly created COM/Serial port and re-try uploading. If you ever get in a 'weird' spot with the bootloader, or you have uploaded code that crashes and doesn't autoreboot into the bootloader, click the RESET button twice (like a double-click) to get back into the bootloader. The red LED will pulse, and all the NeoPixels will turn green so you know that its in bootloader mode.
Arduino Switches The first part of interfacing with hardware is being able to manage digital inputs and outputs. With the built in Circuit Playground hardware & the Arduino library it's super easy! This quick-start example shows how you can use one of the Circuit Playground buttons as an input to control another digital output - the built in LED #include void setup() { // Initialize the circuit playground CircuitPlayground.
Note that on the M0/SAMD based CircuitPython boards, at least, you can also have internal pullups with INPUT_PULLUP when using external buttons, but the built in buttons require INPUT_PULLDOWN . Maybe you're setting up your own external button with pullup or pulldown resistor. If you want to turn off the internal pullup/pulldown just set the pinMode() to plain INPUT © Adafruit Industries https://learn.adafruit.
Adapting Sketches to M0 The ATSAMD21 is a very nice little chip but its fairly new as Arduino-compatible cores go. Most sketches & libraries will work but here's a few things we noticed! The below note are for all M0 boards, but not all may apply (e.g. Trinket and Gemma M0 do not have ARef so you can skip the Analog References note!) Analog References If you'd like to use the ARef pin for a non-3.
AnalogWrite / PWM on Feather/Metro M0 After looking through the SAMD21 datasheet, we've found that some of the options listed in the multiplexer table don't exist on the specific chip used in the Feather M0. For all SAMD21 chips, there are two peripherals that can generate PWM signals: The Timer/Counter (TC) and Timer/Counter for Control Applications (TCC). Each SAMD21 has multiple copies of each, called 'instances'. Each TC instance has one count register, one control register, and two output channels.
TX and SDA (Digital pins 1 and 20) analogWrite() PWM range On AVR, if you set a pin's PWM with analogWrite(pin, 255) it will turn the pin fully HIGH. On the ARM cortex, it will set it to be 255/256 so there will be very slim but still-existing pulses-to-0V.
You can't be guaranteed that this will work on a 32-bit platform because mybuffer might not be aligned to a 2 or 4-byte boundary. The ARM Cortex-M0 can only directly access data on 16-bit boundaries (every 2 or 4 bytes). Trying to access an odd-boundary byte (on a 1 or 3 byte location) will cause a Hard Fault and stop the MCU. Thankfully, there's an easy work around ...
There's a lot of registers on the SAMD21, and you often are going through ASF or another framework to get to them. So having a way to see exactly what's going on is handy. This library from drewfish will help a ton! https://github.com/drewfish/arduino-ZeroRegs (https://adafru.it/Bet) © Adafruit Industries https://learn.adafruit.
Troubleshooting CPLAYBOOT Does not Appear on Windows 10; "ARM7TDMI" Error in Arduino Some people have had difficulty with the Circuit Playground Express on Windows 10 after installing the Arduino IDE and the Arduino Board Support Packages Arduino SAMD and/or Adafruit SAMD. The problem is that these Board Support Packages install unnecessary drivers on Windows 10. This causes two problems: 1. CPLAYBOOT does not appear when double-clicking the reset button on the board. 2.
such as Blink, following the directions in the Arduino (https://adafru.it/C3t) section of this guide. 3. Uninstall when CIRCUITPY is visible as a drive, if you have CircuitPython installed on the board. Each time you'll see an entry in the Device Manager similar to the above, with slightly different wording, and a different COM port. Uninstall the device as shown above. If you are pressed for time, number 1. is the most important driver to uninstall.
Accessories Circuit Playground Express is a great tool for teaching. It has a ton built in, but there's so much more you can do with it. Check out the lists below for some compatible products that will add more to your projects! Packs These packs will help get you started with some accessories already included. Circuit Playground Express - Base Kit $29.95 IN STOCK ADD TO CART Circuit Playground Express Advanced Pack $99.
Small Alligator Clip to Male Jumper Wire Bundle - 12 Pieces $7.95 IN STOCK ADD TO CART Small Alligator Clip to Male Jumper Wire Bundle - 6 Pieces $3.95 IN STOCK ADD TO CART Conductive Hook & Loop Tape - 3" long $7.50 IN STOCK ADD TO CART Capacitive Touch These products can be used with the capacitive touch pads to create interactive art that reacts to human touch. © Adafruit Industries https://learn.adafruit.
Bare Conductive Paint - 50mL $29.95 IN STOCK ADD TO CART Bare Conductive Paint Pen - 10mL $9.95 IN STOCK ADD TO CART Conductive Silver Ink Pen - Standard Tip $49.95 OUT OF STOCK OUT OF STOCK Conductive Silver Ink Pen - Micro Tip $49.95 IN STOCK ADD TO CART © Adafruit Industries https://learn.adafruit.
Copper Foil Tape with Conductive Adhesive - 25mm x 15 meter roll $19.95 IN STOCK ADD TO CART Copper Foil Tape with Conductive Adhesive - 6mm x 15 meter roll $5.95 IN STOCK ADD TO CART Proto-Pasta - 1.75mm 500g Conductive PLA Filament $58.00 IN STOCK ADD TO CART Proto-pasta - 2.85mm Diameter - Conductive Graphite Filament $49.95 OUT OF STOCK OUT OF STOCK © Adafruit Industries https://learn.adafruit.
Robotics These products can add some robot friend flavor to your project. Micro servo $5.95 IN STOCK ADD TO CART Your browser does not support the video tag. Continuous Rotation Micro Servo $7.50 IN STOCK ADD TO CART Wheel for Micro Continuous Rotation FS90R Servo $2.50 IN STOCK ADD TO CART Sewable You can use the following products to sew additions onto your project. © Adafruit Industries https://learn.adafruit.
Flora RGB Smart NeoPixel version 2 - Pack of 4 $7.95 IN STOCK ADD TO CART Stainless Thin Conductive Thread - 2 ply - 23 meter/76 ft $6.95 IN STOCK ADD TO CART Sewable Snaps - 5mm Diameter - Card of 24 $3.95 IN STOCK ADD TO CART Needle set - 3/9 sizes - 20 needles $1.95 IN STOCK ADD TO CART © Adafruit Industries https://learn.adafruit.
Power These products can be used to power your project without using a USB cable. JST-PH Battery Extension Cable - 500mm $1.95 IN STOCK ADD TO CART JST 2-pin Extension Cable with On/Off Switch - JST PH2 $2.95 OUT OF STOCK OUT OF STOCK 3 x AAA Battery Holder with On/Off Switch, JST, and Belt Clip $2.95 IN STOCK ADD TO CART © Adafruit Industries https://learn.adafruit.
3 x AA Battery Holder with On/Off Switch, JST, and Belt Clip $2.95 IN STOCK ADD TO CART 3 x AAA Battery Holder with On/Off Switch and 2-Pin JST $1.95 OUT OF STOCK OUT OF STOCK Lithium Ion Polymer Battery - 3.7v 500mAh $7.95 IN STOCK ADD TO CART Lithium Ion Polymer Battery - 3.7v 1200mAh $9.95 IN STOCK ADD TO CART © Adafruit Industries https://learn.adafruit.
Lithium Ion Polymer Battery - 3.7v 350mAh $6.95 IN STOCK ADD TO CART 2 x 2032 Coin Cell Battery Holder - 6V output with On/Off switch $1.95 IN STOCK ADD TO CART These products can be used to charge the lithium ion polymer batteries listed above. Adafruit Micro-Lipo Charger for LiPo/LiIon Batt w/MicroUSB Jack $6.95 IN STOCK ADD TO CART © Adafruit Industries https://learn.adafruit.
PowerBoost 500 Charger - Rechargeable 5V Lipo USB Boost @ 500mA+ $14.95 IN STOCK ADD TO CART © Adafruit Industries https://learn.adafruit.
UF2 Bootloader Details This is an information page for advanced users who are curious how we get code from your computer into your Express board! Adafruit SAMD21 (M0) and SAMD51 (M4) boards feature an improved bootloader that makes it easier than ever to flash different code onto the microcontroller. This bootloader makes it easy to switch between Microsoft MakeCode, CircuitPython and Arduino.
If the bootloader couldn't start, you will get a red NeoPixel LED. That could mean that your USB cable is no good, it isn't connected to a computer, or maybe the drivers could not enumerate. Try a new USB cable first. Then try another port on your computer! Once the bootloader is running, check your computer. You should see a USB Disk drive... © Adafruit Industries https://learn.adafruit.
Once the bootloader is successfully connected you can open the drive and browse the virtual filesystem. This isn't the same filesystem as you use with CircuitPython or Arduino. It should have three files: CURRENT.UF2 - The current contents of the microcontroller flash. INDEX.HTM - Links to Microsoft MakeCode. INFO_UF2.TXT - Includes bootloader version info. Please include it on bug reports. Using the Mass Storage Bootloader To flash something new, simply drag any UF2 onto the drive.
You may get an alert from the OS that the file is being copied without it's properties. You can just click Yes You may also get get a complaint that the drive was ejected without warning. Don't worry about this. The drive only ejects once the bootloader has verified and completed the process of writing the new code Using the BOSSA Bootloader As mentioned before, the bootloader is also compatible with BOSSA, which is the standard method of updating boards when in the Arduino IDE.
Download and run the installer. We recommend just selecting all the serial port drivers available (no harm to do so) and installing them. Verifying Serial Port in Device Manager If you're running Windows, its a good idea to verify the device showed up. Open your Device Manager from the control panel and look under Ports (COM & LPT) for a device called Feather M0 or Circuit Playground or whatever! If you see something like this, it means you did not install the drivers.
Running bossac on the command line If you are using the Arduino IDE, this step is not required. But sometimes you want to read/write custom binary files, say for loading CircuitPython or your own code. We recommend using bossac v 1.7.0 (or greater), which has been tested. The Arduino branch is most recommended (https://adafru.it/vQb). You can download the latest builds here. (https://adafru.it/s1B) The mingw32 version is for Windows, apple-darwin for Mac OSX and various linux options for Linux.
Updating the bootloader The UF2 bootloader is a new bootloader, and while we've done a ton of testing, it may contain bugs. Usually these bugs effect reliability rather than fully preventing the bootloader from working. If the bootloader is flaky then you can try updating the bootloader itself to potentially improve reliability. In general, you shouldn't have to update the bootloader! If you do think you're having bootloader related issues, please post in the forums or discord.
https://adafru.it/Bml https://adafru.it/Bml https://adafru.it/Bml https://adafru.it/Bml https://adafru.it/Bmo https://adafru.it/Bmo Getting Rid of Windows Pop-ups If you do a lot of development on Windows with the UF2 bootloader, you may get annoyed by the constant "Hey you inserted a drive what do you want to do" pop-ups. Go to the Control Panel. Click on the Hardware and Sound header Click on the Autoplay header © Adafruit Industries https://learn.adafruit.
Uncheck the box at the top, labeled Use Autoplay for all devices Making your own UF2 Making your own UF2 is easy! All you need is a .bin file of a program you wish to flash and the Python conversion script (https://adafru.it/vZb). Make sure that your program was compiled to start at 0x2000 (8k) for M0 boards or 0x4000 (16kB) for M4 boards. The bootloader takes up the first 8kB (M0) or 16kB (M4). CircuitPython's linker script (https://adafru.it/CXh) is an example on how to do that. Once you have a .
Downloads Files: EagleCAD PCB files for Circuit Playground Express (https://adafru.it/Bf9) Fritzing files in Adafruit Fritzing Library (https://adafru.it/aP3) PigHixxx Circuit Playground Express pinout diagram (PDF) (https://adafru.it/Bfa) Circuit Playground Express MakeCode Demo .uf2 (https://adafru.it/Bfb) (copy this to CPLAYBOOT) Circuit Playground Express CircuitPython Demo zip (https://adafru.it/Bfc) (updated for compatibility with CircuitPython 3.