編集履歴一覧に戻る
shigeのアイコン画像

shige が 2021年11月24日15時37分45秒 に編集

初版

タイトルの変更

+

PCからのキーボード情報をbluetoothでmicro:bitに送信

タグの変更

+

Python

+

Microbit

+

Bluetooth

メイン画像の変更

メイン画像が設定されました

本文の変更

+

![microbit and keyboard](https://camo.elchika.com/2476499cb0c6cbf50a4f80dae0b2f7d466e7da78/687474703a2f2f73746f726167652e676f6f676c65617069732e636f6d2f656c6368696b612f76312f757365722f33306665633432662d386239312d343839332d383863362d6132326235336233303666312f34316437653537312d333032332d343938372d626431372d386439366162636563393337/) ## 環境 ・windows10 PC ・キーボード ・microbit ・microUSBケーブル ## コード ```python:microbit.py import sys import serial import msvcrt ser = serial.Serial('COM8', 115200) #COM番号によって変更 while True: if msvcrt.kbhit(): key = msvcrt.getch() ser.write(key) ``` ## 実行コマンド ```bash > python microbit.py ``` @[twitter](https://twitter.com/st43436880/status/1463389783519297536?s=20)