2018年8月22日星期三

How to Use Bluetooth (IOS System)

Our Goal


  • Use Bluetooth under IOS system to connect micro:bit.

Material


Background Knowledge


  • micro:bit is a small pocket-sized programmable computer for teenager programming education. It is put forward by British Broadcasting Corporation(BBC) and aims to make programming study and teaching become more easy and funny.
  • IOS is a mobile operating system created and developed by Apple Inc. It was published earlier since the Macworld Convention at Jan. 9th, 2007. It is originally designed for iphone, and later applied to products like iPod touch,iPad and Apple TV,etc..
  • Bluetooth is a wireless technology standard for exchanging data over short distances (using short-wavelength UHF radio waves in the ISM band from 2.4 to 2.485 GHz[3]) from fixed and mobile devices, and building personal area networks (PANs). We can use Bluettoth to connect multiple devices which resolves the difficulty of simultanuous data transmission.
  • Bittysoftware provides mobile apps and tools for devices like BBC micro:bit.
  • nRF connect is a powerful and versatile tool. You can use it to scan, advertise and explore your Bluetooth Low Energy(BLE) devices and communicate with them.

Software


nRf connect

Search "nRF connect" from your mobile APP store and download it. Here's the interface:
 

Bitty Blue

Search "Bitty Blue" from your mobile APP store and download it. Here's the interface:

Programming


Step 1: Add Package

Click Advanced in the code drawer of MakeCode to see more options.
To program for motor:bit, we have to add a package. Find Add Package in the bottom of code drawer and click it. This will pop up a dialogue box. Search for "bluetooth" and then click to download this package.
Note: If you get a hint that some packages will be deleted due to the problem of incompatibility, you can either follow the prompts, or create a new project in the project menu.

Step 2: Encode

Activate Bluetooth button function when your micro:bit is powered on and started. When connected by Bluetooth, display a string "T" on your micro:bit display. When disconnected, then display a string "F".

Set Bluetooth Mode


To startup micro:bit Bluetooth mode, we need to press the button "A+B" and reset, then micro:bit screen will display a string PAIRING MODE! and a special character. This character is unique to each micro:bit board. It is a special indentifier for Bluetooth.






 

IOS System Paring


  • Open nRF connect and find a device similar to "BBC micro:bit[xxxxx]", then click "CONNECT". This will pop up a request for Bluetooth pairing.
 
  • Click pair to complete Bluetooth connection, and then micro:bit screen will display a "√"(tick mark).
  • Once paired successfully, your micro:bit will restart.

Bluetooth Connection


Open Bitty Blue, click "Scan" to obtain the paired Bluetooth device. Click on it to complete Bluetooth connection. Then micro:bit will display a string "T" and the APP will enter into its home interface.
 
Click the icons in the interface to test its relative functions.
Note: Because we have activated the Bluetooth button function only in the program, so we can only use the test button "Animal Magic" in this case, or the program will go wrong. If you want to test other functions, you need to activate the relative functions in the program.

Bluetooth Disconnection


Exit the APP or shut down Bluetooth switch on your IOS device will disconnect Bluetooth. Once disconnected, micro:bit will display a string "F".

Think


How to write your code to test other module function of micro:bit under the Bluetooth mode?

FAQ


Q: Why we can't successfully connect after restarting the updated program?
A: Each time when micro:bit is restarted, we need to forget the paired deviceand then pair again.
Q: Why we can't download nRF connect app ?
A: You can use other similar software for Bluetooth connection. The app we provided here is just for reference.

Relative Readings


1 条评论:

  1. Goooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooood!

    回复删除

精选博文

How to Make a Counter with microbit

How to Make a Counter with microbit When we have boarded airplane, we often encounter a situation like this: a beautiful stewardess ca...