この記事は何?
たのしいmicro:bitコンテスト 2024に参加しました。
参加テーマはmicro:bit runtime(C/C++)を簡易シェル(以降NT-Shell)で動かせるサンプルコードです。
こちらについて紹介したいと考えています。
作品概要
どのような作品か
micro:bit runtime(C/C++)を簡易シェル(以降NT-Shell)で動かせるサンプルコードを開発しました。
micro:bit v2とシリアルコンソールを接続し、コマンド文字列のキー押下でmicro:bit runtimeのAPIを実行します。
NT-Shellを使うことでシリアルコンソール入力文字列の編集、移動ができ、デバッグ環境として使いやすくなっています。
作品の背景
なぜ作ろうと思ったか、発想のきっかけ
micro:bitの開発はMakeCodeなどのグラフィカルな開発環境でスタートし、プログラミングに慣れていくことが多いと思います。
プログラミング経験が増えると以下の要求がでてくると思います。
- 複数人での開発をしたい。テキストベースのプログラミング言語でバージョン管理をしたい
- RTOSのように複数の処理を同時並行、リアルタイムにおこないたい
前述の要求に対応するため、この作品ではランチェスター大学のmicro:bit C/C++実行環境を利用しています。
また、NT-Shellを組み込むことで使いやすいデバッグ環境を構築しました。
micro:bit初心者から更なる上級者にステップアップしたい場合に使っていただくとよいと考えています。
動作確認方法
環境構築手順
lancaster-university -> microbit-v2-samplesのインストール手順を実行します。
つぎのリポジトリをcloneします。
$ git clone git@github.com:grace2riku/microbit_v2_ntshell_example.git
Cloning into 'microbit_v2_ntshell_example'...
remote: Enumerating objects: 74, done.
remote: Counting objects: 100% (74/74), done.
remote: Compressing objects: 100% (52/52), done.
remote: Total 74 (delta 32), reused 61 (delta 21), pack-reused 0 (from 0)
Receiving objects: 100% (74/74), 42.72 KiB | 245.00 KiB/s, done.
Resolving deltas: 100% (32/32), done.
次のディレクトリに移動します。
$ cd microbit_v2_ntshell_example
サブモジュールを取得します。
microbit_v2_ntshell_example/microbit-v2-samplesディレクトリ以下にファイルが追加されます。
$ git submodule update -i
Submodule 'microbit-v2-samples' (https://github.com/lancaster-university/microbit-v2-samples) registered for path 'microbit-v2-samples'
Cloning into '/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples'...
Submodule path 'microbit-v2-samples': checked out 'd59f07b254f09dd6dbe0a8227e22dd4cb2270fb7'
次のディレクトリに移動します。
$ cd microbit-v2-samples
CMakeLists.txtを以下に修正します。
-set(CODAL_APP_SOURCE_DIR "source")
+set(CODAL_APP_SOURCE_DIR "../source_experiment")
source_experimentディレクトリ以下に今回のコードを格納しています。
CMakeLists.txtの修正以外につぎの修正でもOKです。
codal.jsonにapplicatioを追加します。
"config":{
"MICROBIT_BLE_ENABLED" : 0,
"MICROBIT_BLE_PAIRING_MODE": 0
- }
+ },
+ "application": "../source_experiment"
修正が終わったらビルドします。
正常にビルドが終了するとMICROBIT.bin, MICROBIT.hexが作成されます。
$ python3 build.py
codal-microbit-v2 is already installed
Set target: codal-microbit-v2
Using target-locked.json
Targeting codal-microbit-v2
Supressing -Wexpansion-to-defined.
-- Adding library path: (/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/libraries)
Installing dependencies...
codal-core is already installed
codal-nrf52 is already installed
Cloning into: https://github.com/microbit-foundation/codal-microbit-nrf5sdk
Cloning into 'codal-microbit-nrf5sdk'...
Checking out branch: d41d5c7ebe53a1d01935e61d4ffa891e5112e119
HEAD is now at d41d5c7 Revert "Quieted a warning on fallthrough, as this is intended behaviour"
Using library: codal-microbit-v2
Building WITH softdevice support
Using library: codal-core
Using library: codal-nrf52
Using library: codal-microbit-nrf5sdk
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/build
[ 0%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/core/CodalCompat.cpp.obj
[ 1%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/core/CodalListener.cpp.obj
[ 2%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/core/CodalAssert.cpp.obj
[ 2%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/core/CodalDevice.cpp.obj
[ 3%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/core/CodalComponent.cpp.obj
[ 3%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/core/CodalUtil.cpp.obj
[ 4%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/core/MemberFunctionCallback.cpp.obj
[ 4%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/core/CodalDmesg.cpp.obj
[ 5%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/core/CodalFiber.cpp.obj
[ 5%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/core/CodalHeapAllocator.cpp.obj
[ 6%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/core/gcc_compat.cpp.obj
[ 6%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/core/codal_default_target_hal.cpp.obj
[ 7%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/driver-models/CodalUSB.cpp.obj
[ 7%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/driver-models/AbstractButton.cpp.obj
[ 7%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/driver-models/Accelerometer.cpp.obj
[ 8%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/driver-models/Display.cpp.obj
[ 7%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/driver-models/Compass.cpp.obj
[ 8%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/driver-models/Gyroscope.cpp.obj
[ 9%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/driver-models/I2C.cpp.obj
[ 9%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/driver-models/PinPeripheral.cpp.obj
[ 9%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/driver-models/SPI.cpp.obj
[ 10%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/driver-models/Sensor.cpp.obj
[ 10%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/driver-models/Serial.cpp.obj
[ 11%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/driver-models/Timer.cpp.obj
[ 11%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/AnalogSensor.cpp.obj
[ 12%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/AnimatedDisplay.cpp.obj
[ 12%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/AsciiKeyMap.cpp.obj
[ 13%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/Button.cpp.obj
[ 13%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/FXOS8700.cpp.obj
[ 13%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/GhostFAT.cpp.obj
[ 14%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/HID.cpp.obj
[ 14%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/HIDJoystick.cpp.obj
[ 15%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/HIDKeyboard.cpp.obj
[ 15%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/HIDMouse.cpp.obj
[ 16%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/ILI9341.cpp.obj
[ 16%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/KeyValueStorage.cpp.obj
[ 16%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/LEDMatrix.cpp.obj
[ 17%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/LIS3DH.cpp.obj
[ 17%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/LSM303Accelerometer.cpp.obj
[ 18%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/LSM303Magnetometer.cpp.obj
[ 18%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/LinearAnalogSensor.cpp.obj
[ 19%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/MAG3110.cpp.obj
/var/folders/sm/m02vrtyj4qd37dvsn4l26cp00000gn/T//cc09KLS6.s: Assembler messages:
/var/folders/sm/m02vrtyj4qd37dvsn4l26cp00000gn/T//cc09KLS6.s:122: Warning: setting incorrect section attributes for .data.ramfuncs
[ 19%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/MMA8653.cpp.obj
[ 20%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/MPU6050.cpp.obj
[ 20%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/MessageBus.cpp.obj
[ 20%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/MultiButton.cpp.obj
[ 21%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/NonLinearAnalogSensor.cpp.obj
[ 21%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/PearsonHash.cpp.obj
[ 22%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/PulseIn.cpp.obj
[ 22%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/ST7735.cpp.obj
[ 23%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/ScreenIO.cpp.obj
[ 23%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/StandardSPIFlash.cpp.obj
[ 23%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/TouchButton.cpp.obj
[ 24%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/TouchSensor.cpp.obj
[ 24%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/USBMSC.cpp.obj
[ 25%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/streams/DataStream.cpp.obj
[ 25%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/streams/EffectFilter.cpp.obj
[ 26%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/streams/FIFOStream.cpp.obj
[ 26%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/streams/LevelDetector.cpp.obj
[ 26%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/streams/LevelDetectorSPL.cpp.obj
[ 27%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/streams/LowPassFilter.cpp.obj
[ 27%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/streams/MemorySource.cpp.obj
[ 28%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/streams/Mixer.cpp.obj
[ 28%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/streams/StreamFlowTrigger.cpp.obj
[ 29%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/streams/StreamNormalizer.cpp.obj
[ 29%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/streams/StreamRecording.cpp.obj
[ 30%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/streams/StreamSplitter.cpp.obj
[ 30%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/streams/Synthesizer.cpp.obj
[ 30%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/types/BitmapFont.cpp.obj
[ 31%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/types/CoordinateSystem.cpp.obj
[ 32%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/types/Event.cpp.obj
[ 32%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/types/Image.cpp.obj
[ 32%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/types/ManagedBuffer.cpp.obj
[ 33%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/types/ManagedString.cpp.obj
[ 33%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/types/Matrix4.cpp.obj
[ 33%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/types/RefCounted.cpp.obj
[ 34%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/types/RefCountedInit.cpp.obj
[ 34%] Linking CXX static library ../../libcodal-core.a
[ 34%] Built target codal-core
Scanning dependencies of target codal-nrf52
[ 35%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/NRF52PWM.cpp.obj
[ 36%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/NRF52Radio.cpp.obj
[ 37%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/NRF52Serial.cpp.obj
[ 37%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/NRF52I2C.cpp.obj
[ 37%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/NRF52ADC.cpp.obj
[ 37%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/NRF52PDM.cpp.obj
[ 37%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/NRF52RadioEvent.cpp.obj
[ 37%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/NRF52RadioDatagram.cpp.obj
[ 37%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/NRF52Pin.cpp.obj
[ 38%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/NRF52SPI.cpp.obj
[ 39%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/NRF52TouchSensor.cpp.obj
[ 39%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/NRF52USB.cpp.obj
[ 40%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/NRFLowLevelTimer.cpp.obj
[ 40%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/WS2812B.cpp.obj
[ 40%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/ZSingleWireSerial.cpp.obj
[ 41%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/codal_target_hal_base.cpp.obj
[ 41%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/neopixel.cpp.obj
[ 42%] Building CXX object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/source/peripheral_alloc.cpp.obj
[ 42%] Building ASM object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/asm/CortexContextSwitch.s.obj
[ 43%] Building C object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/nrfx/mdk/system_nrf52833.c.obj
[ 43%] Building ASM object libraries/codal-nrf52/CMakeFiles/codal-nrf52.dir/nrfx_mods/mdk/gcc_startup_nrf52833.S.obj
[ 44%] Linking CXX static library ../../libcodal-nrf52.a
[ 44%] Built target codal-nrf52
[ 45%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/log/src/nrf_log_frontend.c.obj
[ 46%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK_mods/nrf_log_backend_dmesg.c.obj
[ 46%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/log/src/nrf_log_backend_serial.c.obj
[ 47%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/util/app_error.c.obj
[ 47%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/log/src/nrf_log_str_formatter.c.obj
[ 47%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK_mods/app_timer2.c.obj
[ 47%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/util/app_error_handler_gcc.c.obj
[ 47%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/util/app_error_weak.c.obj
[ 48%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/util/app_util_platform.c.obj
[ 49%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK_mods/drv_rtc.c.obj
[ 49%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/crc32/crc32.c.obj
[ 50%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/fds/fds.c.obj
[ 50%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/atomic_fifo/nrf_atfifo.c.obj
[ 50%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/atomic_flags/nrf_atflags.c.obj
[ 51%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/atomic/nrf_atomic.c.obj
[ 51%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/balloc/nrf_balloc.c.obj
[ 52%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/external/fprintf/nrf_fprintf.c.obj
[ 52%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/external/fprintf/nrf_fprintf_format.c.obj
[ 53%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/fstorage/nrf_fstorage.c.obj
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/libraries/codal-microbit-nrf5sdk/nRF5SDK/components/libraries/fds/fds.c: In function 'write_execute':
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/libraries/codal-microbit-nrf5sdk/nRF5SDK/components/libraries/fds/fds.c:1262:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
1262 | if (!record_find_by_desc(&desc, &page))
| ^
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/libraries/codal-microbit-nrf5sdk/nRF5SDK/components/libraries/fds/fds.c:1270:9: note: here
1270 | case FDS_OP_WRITE_HEADER_BEGIN:
| ^~~~
[ 53%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/fstorage/nrf_fstorage_sd.c.obj
[ 54%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/memobj/nrf_memobj.c.obj
[ 54%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK_mods/nrf_pwr_mgmt.c.obj
[ 54%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/ringbuf/nrf_ringbuf.c.obj
[ 55%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/experimental_section_vars/nrf_section_iter.c.obj
[ 55%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/sortlist/nrf_sortlist.c.obj
[ 56%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/strerror/nrf_strerror.c.obj
[ 56%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/libraries/bootloader/dfu/nrf_dfu_svci.c.obj
[ 57%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/common/ble_advdata.c.obj
[ 57%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/common/ble_conn_params.c.obj
[ 57%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/common/ble_conn_state.c.obj
[ 58%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/common/ble_srv_common.c.obj
[ 58%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/nrf_ble_gatt/nrf_ble_gatt.c.obj
[ 59%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/peer_manager/gatt_cache_manager.c.obj
[ 59%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/peer_manager/gatts_cache_manager.c.obj
[ 60%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/peer_manager/id_manager.c.obj
[ 60%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/peer_manager/peer_data_storage.c.obj
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/libraries/codal-microbit-nrf5sdk/nRF5SDK/components/ble/peer_manager/gatt_cache_manager.c: In function 'service_changed_send_in_evt':
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/libraries/codal-microbit-nrf5sdk/nRF5SDK/components/ble/peer_manager/gatt_cache_manager.c:364:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
364 | {
| ^
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/libraries/codal-microbit-nrf5sdk/nRF5SDK/components/ble/peer_manager/gatt_cache_manager.c:385:9: note: here
385 | case NRF_ERROR_NOT_SUPPORTED:
| ^~~~
[ 61%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/peer_manager/peer_database.c.obj
[ 61%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/peer_manager/peer_id.c.obj
[ 61%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/peer_manager/peer_manager.c.obj
[ 62%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/peer_manager/peer_manager_handler.c.obj
[ 62%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/peer_manager/pm_buffer.c.obj
[ 63%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/peer_manager/security_dispatcher.c.obj
[ 63%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/peer_manager/security_manager.c.obj
[ 64%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/softdevice/common/nrf_sdh.c.obj
[ 64%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/softdevice/common/nrf_sdh_ble.c.obj
[ 64%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK_mods/nrf_sdh_soc.c.obj
[ 65%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/ble_services/ble_dfu/ble_dfu.c.obj
[ 65%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK_mods/ble_dfu_bonded.c.obj
[ 66%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/ble_services/ble_dfu/ble_dfu_unbonded.c.obj
[ 66%] Building C object libraries/codal-microbit-nrf5sdk/CMakeFiles/codal-microbit-nrf5sdk.dir/nRF5SDK/components/ble/ble_services/ble_dis/ble_dis.c.obj
[ 67%] Linking CXX static library ../../libcodal-microbit-nrf5sdk.a
[ 67%] Built target codal-microbit-nrf5sdk
[ 67%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/FSCache.cpp.obj
[ 67%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitAccelerometer.cpp.obj
[ 67%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitCompat.cpp.obj
[ 67%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitCompass.cpp.obj
[ 68%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitDevice.cpp.obj
[ 69%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitAudio.cpp.obj
[ 69%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitDisplay.cpp.obj
[ 70%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitCompassCalibrator.cpp.obj
[ 70%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitFileSystem.cpp.obj
[ 71%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitFile.cpp.obj
[ 71%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitFlash.cpp.obj
[ 72%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitLog.cpp.obj
[ 72%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitMemoryMap.cpp.obj
[ 73%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitPowerManager.cpp.obj
[ 73%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitRadio.cpp.obj
[ 74%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitRadioDatagram.cpp.obj
[ 74%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitRadioEvent.cpp.obj
[ 74%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitThermometer.cpp.obj
[ 75%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroBitUSBFlashManager.cpp.obj
[ 75%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/MicroSynth.cpp.obj
[ 76%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/Mixer2.cpp.obj
[ 76%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/NRF52FlashManager.cpp.obj
[ 77%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/NRF52LedMatrix.cpp.obj
[ 77%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/PacketBuffer.cpp.obj
[ 78%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/SoundEmojiSynthesizer.cpp.obj
[ 78%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/SoundExpressions.cpp.obj
[ 78%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/SoundOutputPin.cpp.obj
[ 79%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/SoundSynthesizerEffects.cpp.obj
[ 79%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitAccelerometerService.cpp.obj
[ 80%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitBLEChar.cpp.obj
[ 80%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitBLEManager.cpp.obj
[ 81%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitBLEService.cpp.obj
[ 81%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitBLEServices.cpp.obj
[ 81%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitBLETypes.cpp.obj
[ 82%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitButtonService.cpp.obj
[ 82%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitEddystone.cpp.obj
[ 83%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitEventService.cpp.obj
[ 83%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitIOPinService.cpp.obj
[ 84%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitLEDService.cpp.obj
[ 84%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitMagnetometerService.cpp.obj
[ 85%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitPartialFlashingService.cpp.obj
[ 85%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitTemperatureService.cpp.obj
[ 85%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitUARTService.cpp.obj
[ 86%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/bluetooth/MicroBitUtilityService.cpp.obj
[ 86%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/compat/MbedMemberFunctionCallback.cpp.obj
[ 87%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/compat/MicroBitButton.cpp.obj
[ 87%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/compat/MicroBitI2C.cpp.obj
[ 88%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/source/compat/MicroBitSerial.cpp.obj
[ 88%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/model/MicroBit.cpp.obj
[ 88%] Building CXX object libraries/codal-microbit-v2/CMakeFiles/codal-microbit-v2.dir/model/MicroBitIO.cpp.obj
[ 89%] Linking CXX static library ../../libcodal-microbit-v2.a
[ 89%] Built target codal-microbit-v2
[ 90%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/BlinkyTest.cpp.obj
[ 90%] Building CXX object CMakeFiles/MICROBIT.dir/source/main.cpp.obj
[ 90%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/BLETest.cpp.obj
[ 91%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/AudioTest.cpp.obj
[ 92%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/GPIOTest.cpp.obj
[ 93%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/CapTouchTest.cpp.obj
[ 93%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/ButtonTest.cpp.obj
[ 93%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/AccelerometerTest.cpp.obj
[ 93%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/DeepSleepTest.cpp.obj
[ 93%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/DisplayTest.cpp.obj
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/AccelerometerTest.cpp: In function 'void spirit_level2()':
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/AccelerometerTest.cpp:61:13: warning: unused variable 'z' [-Wunused-variable]
61 | int z = uBit.accelerometer.getZ();
| ^
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/AccelerometerTest.cpp: In function 'void spirit_level()':
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/AccelerometerTest.cpp:90:13: warning: unused variable 'z' [-Wunused-variable]
90 | int z = uBit.accelerometer.getZ();
| ^
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/AccelerometerTest.cpp: At global scope:
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/AccelerometerTest.cpp:11:1: warning: 'void onAccelerometerData(MicroBitEvent)' defined but not used [-Wunused-function]
11 | onAccelerometerData(MicroBitEvent)
| ^~~~~~~~~~~~~~~~~~~
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/AccelerometerTest.cpp:5:1: warning: 'void onCompassData(MicroBitEvent)' defined but not used [-Wunused-function]
5 | onCompassData(MicroBitEvent)
| ^~~~~~~~~~~~~
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/GPIOTest.cpp: In function 'void analog_test()':
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/GPIOTest.cpp:84:17: warning: unused variable 'v' [-Wunused-variable]
84 | int v = p->getAnalogValue();
| ^
[ 93%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/LightLevelTestRaw.cpp.obj
[ 94%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/MicrophoneTest.cpp.obj
[ 94%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/NeopixelsTest.cpp.obj
[ 95%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/NoiseProfiler.cpp.obj
[ 95%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/OOB.cpp.obj
[ 95%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/OOB_v3.cpp.obj
[ 96%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/PowerManagementTest.cpp.obj
[ 96%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/RadioTestRx.cpp.obj
[ 97%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/SerialNumber.cpp.obj
[ 97%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/SerialStreamer.cpp.obj
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/MicrophoneTest.cpp: In function 'void mems_mic_zero_offset_test()':
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/MicrophoneTest.cpp:83:19: warning: variable 'value' set but not used [-Wunused-but-set-variable]
83 | volatile auto value = 0;
| ^~~~~
[ 98%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/SpeakerTest.cpp.obj
[ 98%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/StreamAPITest.cpp.obj
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/OOB_v3.cpp: In function 'void playMelody(const char (*)[6], size_t)':
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/OOB_v3.cpp:118:21: warning: unused variable 'note' [-Wunused-variable]
118 | const char *note = melody[i];
| ^~~~
[ 99%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/TemperatureTest.cpp.obj
[ 99%] Building CXX object CMakeFiles/MICROBIT.dir/source/samples/USBFlashTest.cpp.obj
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/StreamAPITest.cpp: In function 'void stream_test_mic_activate()':
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/StreamAPITest.cpp:25:9: warning: unused variable 'level' [-Wunused-variable]
25 | int level = uBit.audio.levelSPL->getValue();
| ^~~~~
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/StreamAPITest.cpp: In function 'void stream_test_getValue_interval()':
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/StreamAPITest.cpp:37:13: warning: unused variable 'level' [-Wunused-variable]
37 | int level = uBit.audio.levelSPL->getValue();
| ^~~~~
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/USBFlashTest.cpp: In function 'void onReadFlashStatus()':
/Users/k-abe/github/microbit_v2_ntshell_example/microbit-v2-samples/source/samples/USBFlashTest.cpp:12:30: warning: variable 'geometry' set but not used [-Wunused-but-set-variable]
12 | MicroBitUSBFlashGeometry geometry = uBit.flash.getGeometry();
| ^~~~~~~~
[ 99%] Linking CXX executable MICROBIT
[ 99%] Built target MICROBIT
[ 99%] converting to hex file.
[100%] converting to bin file.
[100%] Built target MICROBIT_bin
[100%] Built target MICROBIT_hex
micro:bitをUSBマイクロB-AケーブルでPCに接続します。
micro:bitがUSBメモリとして認識されていると思うので、MICROBIT.hexをドラッグ&ドロップします。
MICROBIT.hexがmicro:bitに書き込まれます。
動作確認はmicro:bit v2で行いました。
つぎのバージョンで動作確認しています。
- V2.00
- V2.21
アプリケーション確認手順
micro:bitをUSBマイクロB-AケーブルでPCに接続します。
デバイス名を取得します。
$ ls /dev/cu.usb*
/dev/cu.usbmodem14102
ターミナルソフトでシリアル通信で接続します。
私はminicomを使いました。ビットレートは115200bpsとしてください。
$ minicom -D /dev/cu.usbmodem14102 -b 115200
ターミナルソフトでエンターキーを押下し、つぎの表示になっていればOKです。
NT-Shell>
helpコマンド
サンプルコードに定義しているコマンドをhelpコマンドで知ることができます。
ターミナルソフトでhelpとタイプし、エンタキーを押下してください。
つぎのように表示されます。
NT-Shell> help
help :This is a description text string for help command.
info :This is a description text string for info command.
setPixelValue :This is a description text string for setPixelValue command.
getPixelValue :This is a description text string for getPixelValue command.
display.scroll :This is a description text string for display.scroll command.
button.isPressed :This is a description text string for button.isPressed.
getTemperature :This is a description text string for getTemperature command.
setPixelValue, getPixelValue, display.scroll, button.isPressed, getTemperatureのコマンドはコマンド内部でmicro:bit runtimeのAPIを呼び出し、機能を実現しています。
コマンドはつぎのファイルで実装しています。
- microbit_v2_ntshell_example/source_experiment/samples/usrcmd.cpp
setPixelValueコマンド
ターミナルでsetPixelValueを押下すると任意のLEDを点灯・消灯することができます。
コマンドはmicro:bit runtimeのsetPixelValueを使っています。
この場合、x = 0, y = 0のLEDが点灯します。
NT-Shell> setPixelValue 0 0 255
消灯する場合はつぎのコマンドになります。
NT-Shell> setPixelValue 0 0 0
display.scrollコマンド
display.scrollコマンドは指定された文字列をLEDにスクロール表示します。
display.scrollコマンドはmicro:bit runtimeのscrollを使っています。
つぎのコマンド実行例だとLEDにhelloとスクロール表示されます。
NT-Shell> display.scroll hello
button.isPressedコマンド
button.isPressedコマンドはボタン押下状態を表示します。
button.isPressedコマンドはmicro:bit runtimeのispressedを使っています。
いずれのボタンが押されていない場合はつぎの表示になります。
NT-Shell> button.isPressed
button A not pressed.
button B not pressed.
logo not touch.
すべてのボタンが押されている場合はつぎの表示になります。
NT-Shell> button.isPressed
button A pressed!
button B pressed!
logo touch!
getTemperatureコマンド
getTemperatureコマンドは温度を表示します。
getTemperatureコマンドはmicro:bit runtimeのgetTemperatureを使っています。
コマンドを実行した例です。
温度が摂氏で表示されます。
NT-Shell> getTemperature
temperature = 22 (degrees celsius)
さいごに
micro:bit runtime(C/C++)をNT-Shellで動かすサンプルコードを紹介しました。
何かお役に立てば嬉しいです。
最後まで長文を読んでいただきありがとうございました🙇♀️