You build a software development environment for MicroBle with the Arduino IDE. The MicroBle uses the nRF51822 present onboard the micro:bit. You install SoftDevice and accelerometer library into the Arduino IDE following the steps below to compile code in purchased assets.
Arduino IDE Version 2.x can’t be used because it can’t set up ‘nRF5FlashSoftDevice’.
Install SoftDevice into the Arduino IDE
- Add following the URL into ‘Additional Board Manager URL’ in File > Preferences on the menu bar of Arduino IDE.
- Search and install ‘Nordic Semiconductor nRF5 Boards by Sandeep Mistry’ in Tools > Board > Boards Manager on the menu bar.
- Choose ‘BBC micro:bit ‘ as following in Tools > Board on the menu bar.
- When you use BLE in the micro:bit (nRF51822), you need to install the pre-compiled binary ‘SoftDevices’ of the protocol stack. ‘SoftDevices’ is additional firmware and as follows.
・S110 (BLE Peripheral) – 96KB
・S130 (BLE Peripheral / Central) – 108KBRefer to ‘Flashing a SoftDevice’ of ‘Arduino Core for Nordic Semiconductor nRF5 based boards‘ about Installing the pre-compiled binary ‘SoftDevices’ of the protocol stack.
Download ‘SoftDevices’. After creating folder ‘nRF5FlashSoftDevice/tool/’, copy the ‘nRF5FlashSoftDevice.jar’ to folder ’C:\Program Files (x86)\Arduino\tools\nRF5FlashSoftDevice\tool’.
- Download the SoftDevice zip file of ‘S130’ from ‘Nordic site’, then copy ‘s130_nrf51_2.0.1_softdevice.hex’ included in the SoftDevice zip file to the folder ‘C:\Users\(user name)\AppData\Local\Arduino15\packages\sandeepmistry\hardware\nRF5\(version)\cores\nRF5\SDK\components\softdevice\s130\hex’.
- Reboot Arduino IDE.
- Choose as follows ‘BBC micro:bit ‘ in Tools > Board on the menu bar, ‘S130’ in > SoftDevice, ‘COMxx(BBC micro:bit)’ in > Port, ‘CMSIS-DAP’ in > Programmer, ‘nRF5 Flash SoftDevice’.
- Choose ‘nRF5 Flash SoftDevice’ then write the selected ‘SoftDevice’ into micro:bit through USB. If the message ‘Done flashing SoftDevice’ is displayed as follows, ‘SoftDevice’ installation is successful.
https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json
Install the accelerometer library into the Arduino IDE
- The library of the accelerometer(MMA8653) uses ‘MMA8653.zip (adafruit.com)‘. Download the Arduino library of the ZIP format.
- Click Sketch > Include Library > import new libraries from .zip files on the menu bar.
- Displayed dialog, you choose the downloaded ZIP format library of the accelerometer(MMA8653). You confirm to register the Sketch example using the accelerometer library in File > Examples on the menu bar.