diff --git a/source/examples/swift-playgrounds/codal.json b/source/examples/swift-playgrounds/codal.json new file mode 100644 index 0000000..5119648 --- /dev/null +++ b/source/examples/swift-playgrounds/codal.json @@ -0,0 +1,20 @@ +{ + "target": { + "name": "codal-microbit-v2", + "url": "https://github.com/lancaster-university/codal-microbit-v2", + "branch": "master", + "type": "git", + "test_ignore": true, + "dev": true + } , + "config":{ + "MICROBIT_BLE_ENABLED" : 1, + "MICROBIT_BLE_PAIRING_MODE": 1, + "MICROBIT_BLE_DEVICE_INFORMATION_SERVICE": 1, + "MICROBIT_BLE_DFU_SERVICE": 1, + "MICROBIT_BLE_EVENT_SERVICE" : 1, + "MICROBIT_BLE_PARTIAL_FLASHING" : 1, + "MICROBIT_BLE_OPEN": 0, + "MICROBIT_BLE_SECURITY_LEVEL": "SECURITY_MODE_ENCRYPTION_NO_MITM" + } +} diff --git a/source/examples/swift-playgrounds/main.cpp b/source/examples/swift-playgrounds/main.cpp index b284c87..e6f6436 100755 --- a/source/examples/swift-playgrounds/main.cpp +++ b/source/examples/swift-playgrounds/main.cpp @@ -36,38 +36,32 @@ DEALINGS IN THE SOFTWARE. MicroBit uBit; -const uint8_t full_heart_arr[] { - 0, 1, 0, 1, 0, - 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - 0, 1, 1, 1, 0, - 0, 0, 1, 0, 0, }; - const uint8_t small_heart_arr[] { - 0, 0, 0, 0, 0, - 0, 1, 0, 1, 0, - 0, 1, 1, 1, 0, - 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, }; + 0, 0, 0, 0, 0, + 0, 255, 0, 255, 0, + 0, 255, 255, 255, 0, + 0, 0, 255, 0, 0, + 0, 0, 0, 0, 0 }; -MicroBitImage full_heart(5,5,full_heart_arr); MicroBitImage small_heart(5,5,small_heart_arr); // we use events abd the 'connected' variable to keep track of the status of the Bluetooth connection void onConnected(MicroBitEvent) { - uBit.display.print(full_heart); + uBit.display.print("C"); } void onDisconnected(MicroBitEvent) { - uBit.display.print(small_heart); + uBit.display.print("D"); } int main() { // Initialise the micro:bit runtime. uBit.init(); + uBit.display.setDisplayMode(DISPLAY_MODE_BLACK_AND_WHITE); + uBit.display.setBrightness(255); // Configuration Tips // Swift Playgrounds relies on the presence of the DFU service to intiate bonding, so