Preface

The BBC Micro:bit is a very popular microcontroller board. It comes packed with features such as a display and various sensors. This board comes with a computing unit and the possibility to connect with various other peripheral devices. It is used by beginners to learn about the fundamentals of computer programming, electronics, and physical computing. It can be programmed using many programming frameworks such as MicroPython and Scratch.

The book covers many aspects of programming the BBC Micro:bit with the MicroPython programming language. The book begins with the basics and setup. Then, it covers the fundamentals of the Python programming language. After that, it explores various aspects of physical computing with the BBC Micro:bit, such as the programming of LEDs, buttons, buzzers, stepper motors, analog input, Pulse Width Modulation (PWM), internal sensors, and radio communication. It also explores topics such as the filesystem and wearable computing with a BBC Micro:bit.

After following the concepts, circuits, and code examples in this book, you will be comfortable with building your own project using the BBC Micro:bit with MicroPython as the preferred programming language.

Who this book is for

This book is for anyone who would like to use the combination of MicroPython and the BBC Micro:bit to build exciting real-life projects. Individuals working in domains such as embedded systems, electronics, software development, IoT, and robotics will find this book quite useful.

What this book covers

Chapter 1, Introduction to the BBC Micro:bit, covers the technical specifications of the BBC Micro:bit.

Chapter 2, Setting Up the Micro:bit and Using Code Editors, covers the installation of various integrated development environments for programming the Micro:bit with MicroPython.

Chapter 3, Python Programming Essentials, explores the basic concepts and syntax of Python programming.

Chapter 4, Advanced Python, dives deeper into the advanced concepts of Python.

Chapter 5, Built-in LED Matrix Display and Push Buttons, explores the programming of the built-in 5 x 5 matrix of LEDs and push buttons.

Chapter 6, Interfacing External LEDs, explores the interfacing and programming of external LEDs.

Chapter 7, Programming External Push Buttons, Buzzers, and Stepper Motors, teaches the programming of external output devices.

Chapter 8, Exploring the Filesystem, covers the built-in filesystem of the Micro:bit.

Chapter 9, Working with Analog Input and PWM, dives deeper into the interfacing of analog input devices. It also explores the PWM and interfacing of the output devices that employ PWM.

Chapter 10, Working with Acceleration and Direction, details working with internal sensors.

Chapter 11, Working with NeoPixels and a MAX7219 Display, teaches the interfacing of the external display.

Chapter 12, Producing Music and Speech, dives into producing music and speech with the Micro:bit.

Chapter 13, Networking and Radio, teaches you how to connect multiple Micro:bits together.

Chapter 14, Advanced Features of the Micro:bit, explores the advanced hardware features of the Micro:bit.

Chapter 15, Wearable Computing and More Programming Environments, covers simple projects in the area of sewable and wearable computing.

To get the most out of this book

You will need a BBC Micro:bit v2 for running the code examples. You will also need Thonny or Mu Editor installed on your computer—the latest versions, if possible. All code examples have been tested using Thonny and Mu Editor on Windows 10 and Linux. The code examples should work with future versions of the BBC Micro:bit, Thonny, Mu Editor, Windows, and Linux releases too.

Prior experience with some programming language, but not necessarily MicroPython, as well as building basic electronic circuits will be helpful when using this book.

Software/hardware covered in the book

Operating system requirements

BBC Micro:bit V2, Thonny, and Mu Editor

Windows, macOS, or Linux

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

You should be comfortable with electronics and computer programming. Prior exposure to Python or MicroPython is desired but not mandatory.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/BBC-Micro-bit-in-Practice. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots and diagrams used in this book. You can download it here: https://packt.link/AYz3z

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “This is because the str1 and pi variables are not of the same data type.”

A block of code is set as follows:

>>> print("This is a test string)
Traceback (most recent call last):
  File "<stdin>", line 1
SyntaxError: invalid syntax

Any command-line input or output is written as follows:

PS C:UsersAshwin> ufs ls
mylib.py main.py test.txt

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “Select System info from the Administration panel.”

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at [email protected] and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you’ve read BBC Micro:bit in Practice, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere? Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below

https://packt.link/free-ebook/9781804610121

  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.178.157