Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
MicroPython Cookbook
MicroPython Cookbook

MicroPython Cookbook: Over 110 practical recipes for programming embedded systems and microcontrollers with Python

Arrow left icon
Profile Icon Marwan Alsabbagh
Arrow right icon
₱2245.99
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (8 Ratings)
Paperback May 2019 452 pages 1st Edition
eBook
₱1256.99 ₱1796.99
Paperback
₱2245.99
Subscription
Free Trial
Arrow left icon
Profile Icon Marwan Alsabbagh
Arrow right icon
₱2245.99
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (8 Ratings)
Paperback May 2019 452 pages 1st Edition
eBook
₱1256.99 ₱1796.99
Paperback
₱2245.99
Subscription
Free Trial
eBook
₱1256.99 ₱1796.99
Paperback
₱2245.99
Subscription
Free Trial

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

MicroPython Cookbook

Getting started with MicroPython

It's an exciting time to work with technologies such as MicroPython. They make tiny and inexpensive hardware devices more accessible, as you can use a high-level language such as Python to code on them. Tasks such as retrieving data from web services can easily be done in a few lines of code, compared to other microcontroller languages that would require many more steps, because they operate at such a low level compared to Python. This is very empowering, as you will get results faster and be able to iterate through different designs and prototypes in a shorter amount of time.

In this chapter, we will provide you with the essential skills to get started and be productive with the software and hardware needed to run MicroPython. You'll learn how to update the firmware and libraries on the device. Recipes to load your first program on the board and use advanced features, such as auto-reloading your code, will also be covered. Finally, a number of recipes will cover the usage of the REPL that is a powerful way to quickly interact and experiment with the available components on MicroPython devices.

In this chapter, we will be covering the following recipes:

  • Flashing the microcontroller firmware
  • Executing your first program
  • Using screen to access the REPL
  • Using Mu to access the REPL
  • Executing commands in the REPL
  • Using the auto-reload feature
  • Updating the CircuitPython Library

What is MicroPython?

MicroPython is the creation of the Australian programmer and physicist Damien George, who launched a Kickstarter campaign in 2013 to support the development of the language and the initial microcontroller hardware that it would run on. After the success of the project, more and more devices (which have a variety of chipsets from different manufactures) have become supported by MicroPython, creating a wide range of devices from which to choose when you make a project using MicroPython.

MicroPython is a lean implementation of the Python 3 programming language that is capable of running on hardware with very limited resources, such as microcontrollers. MicroPython has implemented the majority of features in the Python programming language, such as functions, classes, lists, dictionaries, strings, reading and writing files, list comprehensions, and exception handling.

The REPL is also implemented and can be interacted with using a serial connection. A selection of the core Python libraries is provided, which allows a range of applications to be implemented. The JSON and socket libraries allow web client and server implementations, making Python-based Internet of Things (IoT) projects on microcontrollers a reality.

By bringing one of the most popular and easy to use programming languages to the exciting world of embedded computing, MicroPython opens up new doors for makers and entrepreneurs to bring their creations to life. This book will explore the different ways to leverage the MicroPython language with a variety of unique microcontroller devices that each bring a different set of capabilities to the table.

One of the unique and fascinating aspects of running MicroPython on microcontrollers is that it does not run on an operating system (OS), but instead runs directly on bare metal. These unique characteristics manifest themselves in many ways, such as the ability to run your Python code at the instant the hardware is powered on, as there is no OS that needs to boot up.

The other aspect of this is that the Python code has direct access to control and interact with the hardware, creating hardware possibilities that would not be possible with a typical Python application running on an OS.

As we know now that MicroPython runs on a microcontroller, let's see what microcontrollers are all about.

What is a microcontroller?

Microcontrollers are small computers on a single chip. They usually include a CPU, memory, and input/output peripherals. They will have more limited computing resources than what might be found on a modern PC.

Compared to a PC, however, they can be made to a much smaller dimension, allowing them to be embedded in all sorts of electronic and mechanical devices. Their power consumption is often far less in orders of magnitude, thus providing battery life for days. They have a much lower cost per unit, which opens up possibilities of having hundreds of such devices to collect sensor data across a broad geographical area and still be financially feasible.

Traditionally, it was a difficult process to create applications on microcontrollers because you would have to write very low-level code that took time and was difficult to debug. MicroPython brings the ease of use of Python to microcontroller. It's able to provide this easier interaction with the hardware, and yet still work in such a resource constrained environment and provide a wide range of functionality with a strong level of responsiveness.

What is CircuitPython?

CircuitPython is a branch of MicroPython created by Adafruit Industries that makes working with microcontrollers simpler. It has excellent support for many of the sensors and components that come with Adafruit devices through its Python libraries. It also allows code to be easily loaded and run without having to install any additional software applications by exposing the microcontroller's storage as a disk drive.

Generally, the differences between MicroPython and CircuitPython are minor, and, in many instances, code will run the same on both implementations.

What is the Circuit Playground Express?

The Adafruit Circuit Playground Express is an inexpensive, yet versatile microcontroller with a rich set of input and output devices that comes built-in with the device. The following are some of the main hardware features present in this device:

  • 10 mini NeoPixels, each with the ability to display a full range of colors
  • As motion sensor (triple-axis accelerometer with tap detection and free-fall detection)
  • A temperature sensor
  • A light sensor
  • A sound sensor
  • A mini speaker
  • Two push buttons, which are labeled A and B
  • A slide switch
  • An infrared receiver and transmitter
  • Eight alligator-clip friendly input/output pins
  • Supports I2C and PWM output
  • Seven capacitive touch inputs
  • A red LED
  • A reset button
  • An ATSAMD21 ARM Cortex M0 processor, running at 3.3 V and 48 MHz
  • 2 MB of flash storage
  • A micro USB port for connecting to a PC

These will be the only required devices for eight chapters. Later chapters will introduce a different set of devices.

Where to buy

The Adafruit Circuit Playground Express can be purchased directly from Adafruit (https://www.adafruit.com/product/3333). It can also be purchased from online retailers, such as Amazon and Pimoroni.

For the purpose of this book, we recommend buying the Circuit Playground Express – Base Kit (https://www.adafruit.com/product/3517) and also includes a USB cable and battery pack so that projects can easily be made portable.

References

Here are a few references:

Flashing the microcontroller firmware

In this recipe, we will show how to flash the firmware on the Circuit Playground Express with the latest CircuitPython firmware. There are two reasons to this before you start working with this device. First, the device also supports the Microsoft MakeCode programming environment and flashing the device with the CircuitPython firmware prepares it for use with the Python language.

Second, the CircuitPython language is under constant development, with a release every few months, so it is a good idea to update the firmware from time to time to load the latest release of the language onto the board.

Getting ready

This chapter's introduction gives us directions on how to buy the Circuit Playground Express, which will be required for all the recipes in this chapter. A USB micro B cable and a computer running macOS, Windows, or Linux will also be required.

How to do it...

Let's look at the following steps:

  1. Download the latest CircuitPython Circuit Playground Express UF2 file (https://github.com/adafruit/circuitpython/releases/latest). The name of the UF2 file for version 3.1.2 of CircuitPython is adafruit-circuitpython-circuitplayground_express-3.1.2.uf2. For each release of CircuitPython, there are many different uf2 files for different supported microcontrollers. Make sure that you download the file for the Circuit Playground Express device.
We will use the latest stable version of CircuitPython in this recipe, which is currently 3.1.2.
  1. Connect the USB cable to the Circuit Playground Express and the computer.
  2. Double-click the reset button located at the center of the board. If all goes well, you will see all the LEDs turn green; otherwise, there is most likely an issue with the USB cable being used. In some instances, if a double-click doesn't work, try a single click of the reset button.
  1. You will see a new disk appear called CPLAYBOOT:
  1. Copy the UF2 file into this drive.
  2. Once the UF2 file has been fully written to the device, the firmware will be updated and a new drive will appear, called CIRCUITPY:

Now, our Circuit Playground Express can be used.

How it works...

Traditionally, special software has had to be installed and used to handle the delicate process of flashing a microcontroller. Microsoft developed the UF2 method, which greatly simplifies the process by not requiring any special software or command-line execution to flash the microcontroller.

Once the board is placed into the bootloader mode, it will then expect a UF2 file to be saved to it. When the UF2 is copied to the drive, the microcontroller will detect that the file copy has been completed and then automatically proceed to flash the microcontroller and restart the device, at which point the device is reattached and ready to be used.

The UF2 file format can be found athttps://github.com/Microsoft/uf2.

There's more...

The UF2 approach to flashing microcontroller firmware makes the process easier and faster compared to previous approaches. Not all MicroPython boards support the UF2 method and so require the more involved approach of installing special software to do the firmware flashing. The exact process and software required varies between different boards and manufactures.

When you use this flashing software, it will frequently require that you know the exact name of the serial device that the device appears as on your computer. The naming of these devices varies between Windows, Linux, and macOS. This type of software is usually required to be run in the Terminal, so you'll have to have some command-line knowledge to inter with it. For all these reasons, the use of UF2 with supported devices such as the Circuit Playground Express is the preferred way of starting your experimentation with MicroPython.

See also

Executing your first program

In this recipe, we will show you how to load your first program on the Circuit Playground Express and how to modify the program and reload it. The program will then light one of the ten NeoPixels that come available on the board.

Getting ready

Once the Circuit Playground Express has had the CircuitPython firmware flashed, you may load Python scripts onto the board and run them.

How to do it...

Let's have a look at how to do this:

  1. Make sure that the board is connected to your computer with a USB cable and that the CIRCUITPY drive appears.
  2. Save a text file on the drive with the following contents and name it main.py:
from adafruit_circuitplayground.express import cpx
import time

cpx.pixels[0] = (255, 0, 0) # set first NeoPixel to the color red
time.sleep(60)
  1. Once the file has been saved, eject the drive, and remove and reconnect the USB cable from the computer.
  2. The first NeoPixel on the drive should light up with a red color.
  3. Open the main.py file in your text editor of choice and change the cpx.pixels[0] line to cpx.pixels[1]. Save the file. This change will make the second NeoPixel light up instead of the first.
  4. Eject the drive, remove, and then reconnect the USB cable to see the change take effect.

How it works...

When the device is turned on it looks for certain files, such as code.py or main.py, that, if found, will be executed as part of the startup process. In this way, you can specify the code you want run when the device is powered on. The script first imports the adafruit_circuitplayground.express library so that it can control the NeoPixels. The first NeoPixel is set to the color red by giving it a set of appropriate RGB values.

Finally, the script will sleep for 60 seconds so that the LED remains lit for one minute before the script ends execution.

There's more...

Now that the board has been loaded with a Python script, it can be disconnected from the computer and have the battery pack attached to it. Once the battery pack is powered on by the script, it should run and light up the selected NeoPixel.

This is a simple way to create portable and inexpensive projects that can have a code running directly from the board with no need for a connected PC and can be powered simply by three AAA batteries.

See also

Using screen to access the REPL

Linux and macOS have powerful Terminal emulators, such as screen, that can be used to directly connect to the device's Read-Eval-Print Loop (REPL) over a serial (USB) connection. This recipe will show how to connect to the REPL and start running a Python code interactively.

Getting ready

Either macOS or a Linux computer may be used for this recipe and may require the screen command to be available. On macOS, the Screen application is built-in and so requires no installation. On Ubuntu, the Linux Screen can be installed with the apt install screen command.

How to do it...

Let's have a look at how to connect the REPL and run the code:

  1. Open the computer's Terminal application.
  2. List device names before plugging in device by running ls /dev/ttyACM* on Linux or ls /dev/tty.* on macOS.
  3. Connect the board to your computer with a USB cable.
  4. List the device names again with the same command to discover the device name of the board.
  5. If the device name is /dev/ttyACM0, then the screen command would be screen /dev/ttyACM0 115200.
  6. Enter the command in the Terminal and start the Screen application.
  7. If Screen is able to connect successfully, the Python REPL should appear on the Terminal with output similar to the following text:
Adafruit CircuitPython 3.1.2 on 2019-01-07; Adafruit CircuitPlayground Express with samd21g18
>>>
  1. If the prompt doesn't appear, you can try pressing Ctrl + C and then press Enter, which will stop the currently running Python script and run the REPL with the following message:
Press any key to enter the REPL. Use CTRL-D to reload.
  1. Once the REPL prompt appears, we will have to test if the prompt is working by evaluating the 1+1 expression. It should produce the following output:
>>> 1+1
2

How it works...

The Circuit Playground Express exposes a serial device over the USB connection, which can be accessed by a number of different Terminal emulator programs. Besides screen, there are other programs, such as picocom and minicom, that may also be used.

The last parameter that was set as 115,200 in the command sets the baud rate of the connection, which should be set at that speed. Once the connection is successfully established, an interactive session is commenced that allows expressions to be directly evaluated on the device and the output is directly displayed on the Terminal.

There's more...

Many of the recipes in the book will introduce the different parts of a script using the REPL. This will give you a chance to get immediate feedback as you run each snippet of code. Once you've entered the different snippets in the REPL you can also use REPL features to assist in your experimentation with the code. You can use the up and down arrow keys to move through the history of commands that have been entered in the REPL. For example, if you had just executed a line of code in the REPL that turned on a specific pixel on the board, you could press the up key and change which pixel is lit up by editing the line and pressing Enter again.

See also

Using Mu to access the REPL

Mu is an easy-to-use graphical code editor written in Python that runs on Windows, macOS, Linux, and the Raspberry Pi. In this recipe, we will learn how to install Mu and use it to access the REPL on the Circuit Playground Express.

Getting ready

This recipe requires Python and pip to be installed on the computer. The Mu editor will be installed using the pip command, so this recipe can optionally be run within virtualenv.

How to do it...

Let's have a look at how to do this:

  1. Execute the following pip3 install mu-editor command to install the Mu editor.
  2. Run the mu-editor command to start the editor.
  3. The first time you run the editor, it will ask which mode it should run in. On the following screenshot, select the Adafruit CircuitPython mode:
  1. Click the Serial button on the toolbar to open a REPL session with the device.
  2. On Linux systems, if a Cannot connect to device error appears, then exit the editor and start it again with the sudo /full/path/to/mu-editor command, where the absolute path to the editor is given.
  3. Once a connection is successfully made to the device, you can test the REPL by evaluating the 1+1 expression, which should produce output like the following screenshot:

How it works...

When you click on the Serial button in the Mu editor, it will attempt to open a serial connection to the board. If successful, it captures your input, sends it the device, and displays the output just as a typical Terminal emulator would.

The beauty of this application is that it works on all the major desktop OSes and automatically finds the correct device address without the need to manually specify it, as is required by your typical Terminal emulators. It also has a very simple and approachable layout, making it easy to use for first-time users to connect to microcontrollers.

There's more...

The Mu editor is a great graphical application to begin with when you first start working with MicroPython. Its simple and intuitive design makes it easy to get productive fast and makes it fun to explore its different features. Beyond its REPL features, it also has the main part of the Screen, which can be used to edit and save Python scripts. It has code-editing features such as code completion and will show helpful popups with details on a function's accepted arguments and documentation on what the function does.

See also

Executing commands in the REPL

The following recipe shows different ways that the REPL can be used.

Getting ready

Any one method can be used from the preceding two recipes here to obtain a REPL.

How to do it...

  1. Open the REPL through your preferred application.
  2. Many of the same capabilities provided by the REPL in CPython also work in the MicroPython implementation. The last returned value can be accessed with _:
>>> 2 + 2
4
>>> _ + 2
6
  1. Continuation lines are also supported, making it possible to define functions or for loops through the REPL, as shown in the following output:

>>> def add(a, b):
... return a + b
...
...
...
>>> add(2, 2)
4
>>>
  1. Arbitrary precision integers are also supported, even on constrained microcontroller hardware. The following code shows arithmetic with integers beyond the limit of a 64-bit integer value:
>>> 2**100 + 2**101
3802951800684688204490109616128

How it works...

The REPL implementation has most of the features that we've come to know and love in the CPython implementation. The MicroPython implementation has to deal with tough hardware constraints so that it can run on a microcontroller. But, even with these constraints, the end user experience of the REPL in both implementations is almost identical, making it an easy transition for Python developers.

There's more...

The REPL can be an invaluable tool when you want to experiment with certain MicroPython libraries or certain features on a device. It lets you easily import different Python modules and call functions provided by those libraries in a more direct fashion to discover how they will actually interact with the hardware. Many components on these microcontrollers can be fine-tuned for different project needs. The REPL frequently ends up being an ideal place to do this fine-tuning.

See also

Using the auto-reload feature

The following recipe shows how to use auto-reload so that the cycle of editing and running code can become much faster and more fun.

Getting ready

Any of the methods used in the previous recipes can be used here to obtain a REPL.

How to do it...

Let's have a look at how to do this:

  1. Open the main.py file and save the print('hi there') statement in the file.
  2. Open the REPL through your preferred application. With the REPL open, press Ctrl + D. The following output should appear:
Adafruit CircuitPython 3.1.2 on 2019-01-07; Adafruit CircuitPlayground Express with samd21g18
>>>
>>>
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
main.py output:
hi there

Press any key to enter the REPL. Use CTRL-D to reload.
  1. Edit the main.py file and change the contents to print('hi there again'). The following output should be automatically displayed:

soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
main.py output:
hi there again

Press any key to enter the REPL. Use CTRL-D to reload.

How it works...

By pressing Ctrl + D, the board will enter into auto-reload mode. In this mode, you can open the main.py file in your text editor of choice, and, the moment you save the file, the board detects that a change has happened and performs a soft reboot.

The soft reboot can be seen in the Screen output and then the new version of the code is executed with its output displayed immediately.

There's more...

It is quite common to start a script with a few basic lines of code to get the initial part of a script functioning. Once you have your first basic version running, you will go through many iterations to tweak and enhance it so that it behaves just the way you want it to. Beyond these tweaks, the inevitable bugs will appear in your code as you wrangle it into submission. The auto-reload feature will become your best friend during these intensive coding sessions as it will let you get results much faster and in an intuitive way.

See also

Updating the CircuitPython Library

In addition to updating the firmware, there is also a rich set of Python libraries called the CircuitPython Library that can also be updated with the latest supported features.

Getting ready

Any of themethods used in the previous recipes can be used hereto obtain a REPL.

How to do it...

Let's have a look at how to do this:

  1. Open the REPL through your preferred application.
  2. Download the latest CircuitPython Library Bundle release (https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/latest). The name of the bundle file is adafruit-circuitpython-bundle-3.x-mpy-20190212.zip. Since our firmware is using the 3.x release, we must select the bundle that is also for the 3.x release. Always use the mpy version, as this is optimized to use less disk space and has reduced memory usage.
We are using the latest auto-release version of the CircuitPython Library Bundle in this recipe, which is version 20190212 of the 3.x series.
  1. Extract the .zip file to a location on your computer.
  2. If the CIRCUITPY drive does not contain a lib folder, then create one now.
  3. Copy the contents of the extracted lib folder into the lib folder on the device.
  4. Perform a soft reboot in the REPL by pressing Ctrl + D.
  5. Run import simpleio in the REPL.
  6. If it has executed successfully, then the libraries have been successfully loaded, as the simpleio module is not part of the firmware and was imported from the library folder.

How it works...

The lib path that was created is one of the standard paths the CircuitPython will look in when importing Python packages. By adding Python packages to this folder, this makes it available for import by any scripts running on the device.

The mpy files are built from the original source py files and bundled all together in one package to make it easier to install.

There's more...

The CircuitPython Library is under constant development, so it's important to know how to update the library on the board so that you can get the latest features. As you experiment with code from projects you find on the internet, you might occasionally find examples that don't work on your board because you are running an outdated version of the CircuitPython Library. Keep your board to the latest version, as this can help prevent this from happening.

See also

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Load and execute your first program with MicroPython
  • Program an IoT device to retrieve weather data using a RESTful API
  • Get to grips with integrating hardware, programming, and networking concepts with MicroPython

Description

MicroPython is an open source implementation of Python 3 that runs in embedded environments. With MicroPython, you can write clean and simple Python code to control hardware instead of using complex low-level languages such as C and C++. This book guides you through all the major applications of the MicroPython platform to build and program projects that use microcontrollers. This MicroPython book covers recipes that will help you experiment with the programming environment and hardware programmed in MicroPython. You'll find tips and techniques for building a variety of objects and prototypes that can sense and respond to touch, sound, position, heat, and light. This book will take you through the uses of MicroPython with a variety of popular input devices and sensors. You'll learn techniques to handle time delays and sensor readings, and apply advanced coding techniques to create complex projects. As you advance, you'll deal with Internet of Things (IoT) devices and integration with other online web services. In addition to this, you'll use MicroPython to make music with bananas and create portable multiplayer video games that incorporate sound and light animations into the gameplay. By the end of this book, you'll have mastered the tips and tricks to troubleshoot your development problems and take your MicroPython project to the next level.

Who is this book for?

If you want to build and program projects that use microcontrollers, this book will offer you dozens of recipes to guide you through all the major applications of the MicroPython platform. Although no knowledge of MicroPython or microcontrollers is expected, a general understanding of Python is necessary to get started with this book.

What you will learn

  • Execute code without any need for compiling or uploading using REPL (read-evaluate-print-loop)
  • Program and control LED matrix and NeoPixel drivers to display patterns and colors
  • Build projects that make use of light, temperature, and touch sensors
  • Configure devices to create Wi-Fi access points and use network modules to scan and connect to existing networks
  • Use Pulse width modulation to control DC motors and servos
  • Build an IoT device to display live weather data from the internet at the touch of a button
Estimated delivery fee Deliver to Philippines

Standard delivery 10 - 13 business days

₱492.95

Premium delivery 5 - 8 business days

₱2548.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 21, 2019
Length: 452 pages
Edition : 1st
Language : English
ISBN-13 : 9781838649951
Category :
Languages :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Philippines

Standard delivery 10 - 13 business days

₱492.95

Premium delivery 5 - 8 business days

₱2548.95
(Includes tracking information)

Product Details

Publication date : May 21, 2019
Length: 452 pages
Edition : 1st
Language : English
ISBN-13 : 9781838649951
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₱260 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₱260 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 6,175.97
MicroPython Projects
₱2245.99
Internet of Things Projects with ESP32
₱1683.99
MicroPython Cookbook
₱2245.99
Total 6,175.97 Stars icon
Banner background image

Table of Contents

16 Chapters
Getting started with MicroPython Chevron down icon Chevron up icon
Controlling LEDs Chevron down icon Chevron up icon
Creating Sound and Music Chevron down icon Chevron up icon
Interacting with Buttons Chevron down icon Chevron up icon
Reading Sensor Data Chevron down icon Chevron up icon
Button Bash Game Chevron down icon Chevron up icon
Fruity Tunes Chevron down icon Chevron up icon
Let's Move It, Move It Chevron down icon Chevron up icon
Coding on the micro:bit Chevron down icon Chevron up icon
Controlling the ESP8266 Chevron down icon Chevron up icon
Interacting with the Filesystem Chevron down icon Chevron up icon
Networking Chevron down icon Chevron up icon
Interacting with the Adafruit FeatherWing OLED Chevron down icon Chevron up icon
Building an Internet of Things (IoT) Weather Machine Chevron down icon Chevron up icon
Coding on the Adafruit HalloWing Microcontroller Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(8 Ratings)
5 star 12.5%
4 star 25%
3 star 25%
2 star 25%
1 star 12.5%
Filter icon Filter
Top Reviews

Filter reviews by




Kindle Customer Mar 06, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Sehr gutes Buch. Die Beispiele funtionieren auch in der wirklichkeit.
Amazon Verified review Amazon
alf Dec 24, 2022
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Sei muito pouco de electrónica! Vou tentar aprender mais qualquer coisa com este livro.
Amazon Verified review Amazon
Scott H. Sep 25, 2022
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
A well-written and presented reference book. A wide variety of content.
Amazon Verified review Amazon
Peter R. Sep 19, 2022
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
Kändes som all var styrt via Adafruit. Vilket jag inte tyckte om. Men troligen för att boken skrevs 2019.
Amazon Verified review Amazon
wayne durden Jan 05, 2020
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
Most of the projects in the book deal with how to use Adafruit devices with Adafruit libraries. It's OK if that's what you like to do. As far as a cookbook goes it is more of a 'how to fix canned vegetables' than how to actually make something from scratch. I was expecting more how to do interfacing that did not rely so much on canned hardware and libraries. If you want to use this book, you will need to go ahead and get the Adafruit Circuit Playground Express in order to do most of the projects. Also there are projects using the Adafruit CRICKIT, Feather HUZZAH ESP8266, Hollowing MO Express and The micro:bit. The book is well written, well structured and easy to follow.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela