+21622886281
App Inventor Micro:bit

Switch on the smartphone torch by Micro:bit

Micro:bit is a small, programmable computer that is designed to be easy to use for beginners. It has a variety of inputs and outputs, including a built-in Bluetooth module, which allows it to communicate wirelessly with other devices such as smartphones and tablets.

It is possible to control the flashlight on a smartphone using a Micro:bit via Bluetooth. Here’s a general outline of the steps you would need to take:

  1. Program the Micro:bit to act as a Bluetooth central, so that it can discover and connect to other Bluetooth devices such as smartphones.
  2. Create a smartphone app that can act as a Bluetooth peripheral, and can receive commands from the Micro:bit to turn the flashlight on or off.
  3. Once the Micro:bit has discovered and connected to the smartphone, you can use the Micro:bit to send commands to the smartphone app to turn the flashlight on or off.

Purpose of this tutorial:

In this tutorial we will see how to turn on the smartphone torch using the Micro:bit card.

This is why we are going to create two programs: a mobile application with App Inventor for the smartphone and a makecode program for the Micro:bit card.

Necessary components

Micro:bit

Micro:bit is a small, programmable computer that is designed to be easy to use for beginners. It is developed by the Micro:bit Educational Foundation, a not-for-profit organization based in the UK. The Micro:bit was originally intended to be used as a tool for teaching computer science and programming in schools, but it has since been adopted by a wide range of users for a variety of different projects.

The Micro:bit is a small device, about the size of a credit card, that has a variety of inputs and outputs, including a 5×5 LED matrix, two programmable buttons, and a built-in accelerometer, compass, and thermometer. It also has a built-in Bluetooth module, which allows it to communicate wirelessly with other devices such as smartphones and tablets.

The Micro:bit can be programmed using a variety of languages, including Python and JavaScript, and can be used for a wide range of projects, from simple games to more advanced applications such as controlling robots and drones.

Makecode program

Here is the makecode program which allows you to connect the Micro:bit card to the smartphone and send a message containing the order to turn on the smartphone torch.

Creation of the application with App Inventor:

We are going to create a mobile application named ‘allumer_torche’ with App Inventor which allows you to receive a message from the Micro:bit card.

We propose to create the design of the application, with the following visual:

Programming with App Inventor

To program the application, App Inventor offers us to use the Blocks space, which allows you to create a program in the form of a block diagram. Very easy to use but requiring a little programming logic.

Here is the program of the application created in the Blocks area of ​​the Inventor App:

Remark:

After installing the mobile application on your Smartphone, follow these steps to connect to the Micro:bit card:

  1. Click on the ‘scan‘ button
  2. After finding the Micro:bit card, Click on the ‘Stop Scan’ button
  3. Tap the name of the Micro:bit card
  4. Finally click on the ‘connect’ button

Download project Download application




0 commentaire


Leave a comment

Votre adresse e-mail ne sera pas publiée.

Scroll to Top