pxt-calliope/docs/reference/bluetooth.md
Juri Wolf 5f7a8e5301
Updates for V4 (#197)
* update yotta defaults for 16kb devices

* refactor deprecated blocks

* updates for button events

* update button events

* update refference

* update docs

* update docs

* update button event blocks

* update docs

* update block id
2022-08-10 09:36:19 -07:00

2.2 KiB

Bluetooth

Support for additional Bluetooth services.

~hint

For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be paired with the @boardname@. Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.

~

bluetooth.startAccelerometerService();
bluetooth.startButtonService();
bluetooth.startIOPinService();
bluetooth.startLEDService();
bluetooth.startMagnetometerService();
bluetooth.startTemperatureService();
bluetooth.onBluetoothConnected(() => {});
bluetooth.onBluetoothDisconnected(() => {});
bluetooth.setTransmitPower(7);

UART

bluetooth.startUartService();
bluetooth.uartReadUntil("");
bluetooth.uartWriteLine("");
bluetooth.uartWriteString("");
bluetooth.uartWriteNumber(0);
bluetooth.uartWriteValue("", 0);
bluetooth.onUartDataReceived(",", () => {})

Advanced

For more advanced information on the @boardname@ Bluetooth UART service including information on using a smartphone, see the Lancaster University @boardname@ runtime technical documentation

See Also

startAccelerometerService, startButtonService, startIOPinService, startLEDService, startMagnetometerService, startTemperatureService, startUartService, uartReadUntil, uartWriteLine, uartWriteString, uartWriteNumber, uartWriteValue, onBluetoothConnected, onBluetoothDisconnected

bluetooth