2016-06-14 15:30:07 +02:00
|
|
|
#include "pxt.h"
|
|
|
|
#include "MESEvents.h"
|
|
|
|
|
|
|
|
using namespace pxt;
|
2016-06-14 22:17:20 +02:00
|
|
|
//% color=#0082FB weight=20
|
2016-06-14 15:30:07 +02:00
|
|
|
namespace bluetooth {
|
|
|
|
/**
|
|
|
|
* Starts the Bluetooth IO pin service
|
|
|
|
*/
|
2016-06-14 22:17:20 +02:00
|
|
|
//% help=bluetooth/start-io-pin-service
|
2016-06-14 22:47:18 +02:00
|
|
|
//% blockId=bluetooth_start_io_pin_service block="bluetooth io pin service" blockGap=8
|
2016-06-14 15:30:07 +02:00
|
|
|
void startIOPinService() {
|
|
|
|
new MicroBitIOPinService(*uBit.ble, uBit.io);
|
|
|
|
}
|
2016-06-14 22:17:20 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Starts the Bluetooth LED service
|
|
|
|
*/
|
|
|
|
//% help=bluetooth/start-led-service
|
2016-06-14 22:47:18 +02:00
|
|
|
//% blockId=bluetooth_start_led_service block="bluetooth led service" blockGap=8
|
2016-06-14 22:17:20 +02:00
|
|
|
void startLEDService() {
|
|
|
|
new MicroBitLEDService(*uBit.ble, uBit.display);
|
|
|
|
}
|
2016-06-14 22:24:55 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Starts the temperature service
|
|
|
|
*/
|
|
|
|
//% help=bluetooth/start-temperature-service
|
2016-06-14 22:47:18 +02:00
|
|
|
//% blockId=bluetooth_start_temperature_service block="bluetooth temperature service" blockGap=8
|
2016-06-14 22:24:55 +02:00
|
|
|
void startTemperatureService() {
|
|
|
|
new MicroBitTemperatureService(*uBit.ble, uBit.thermometer);
|
|
|
|
}
|
2016-06-14 22:39:24 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Starts the magnetometer service
|
|
|
|
*/
|
|
|
|
//% help=bluetooth/start-magnetometer-service
|
2016-06-14 22:47:18 +02:00
|
|
|
//% blockId=bluetooth_start_magnetometer_service block="bluetooth magnetometer service" blockGap=8
|
2016-06-14 22:39:24 +02:00
|
|
|
void startMagnetometerService() {
|
|
|
|
new MicroBitMagnetometerService(*uBit.ble, uBit.compass);
|
|
|
|
}
|
2016-06-14 22:47:18 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Starts the accelerometer service
|
|
|
|
*/
|
|
|
|
//% help=bluetooth/start-accelerometer-service
|
|
|
|
//% blockId=bluetooth_start_accelerometer_service block="bluetooth accelerometer service" blockGap=8
|
|
|
|
void startAccelerometerService() {
|
|
|
|
new MicroBitAccelerometerService(*uBit.ble, uBit.accelerometer);
|
|
|
|
}
|
2016-06-14 22:53:05 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Starts the button service
|
|
|
|
*/
|
|
|
|
//% help=bluetooth/start-button-service
|
|
|
|
//% blockId=bluetooth_start_button_service block="bluetooth button service" blockGap=8
|
|
|
|
void startButtonService() {
|
|
|
|
new MicroBitButtonService(*uBit.ble);
|
|
|
|
}
|
2016-06-14 15:30:07 +02:00
|
|
|
}
|