Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
source/main.cpp@75:6606a580ebc4, 2019-01-23 (annotated)
- Committer:
- HelGast95
- Date:
- Wed Jan 23 14:17:18 2019 +0000
- Revision:
- 75:6606a580ebc4
- Parent:
- 74:12b9444a2fb4
- Child:
- 76:596c9924e51b
conversion a float del voltaje para enviarlo al JSON El BLE se desconecta cada vez que entra a la callback de read
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| HelGast95 | 73:a91805f9e9f0 | 1 | #define END_OF_JSON 0xFE |
| mbed_official | 1:72c60abef7e7 | 2 | |
| HelGast95 | 73:a91805f9e9f0 | 3 | #include "mbed.h" |
| HelGast95 | 73:a91805f9e9f0 | 4 | #include "picojson.h" |
| HelGast95 | 73:a91805f9e9f0 | 5 | #include "stats_report.h" |
| HelGast95 | 73:a91805f9e9f0 | 6 | |
| HelGast95 | 73:a91805f9e9f0 | 7 | /* Librerías para BLE - Servicio GATT */ |
| mbed_official | 1:72c60abef7e7 | 8 | #include "ble/BLE.h" |
| mbed_official | 1:72c60abef7e7 | 9 | #include "ble/Gap.h" |
| HelGast95 | 73:a91805f9e9f0 | 10 | #include "ble/DiscoveredCharacteristic.h" |
| HelGast95 | 73:a91805f9e9f0 | 11 | #include "ble/DiscoveredService.h" |
| HelGast95 | 73:a91805f9e9f0 | 12 | |
| HelGast95 | 74:12b9444a2fb4 | 13 | bool serviceDiscovered = false; |
| HelGast95 | 73:a91805f9e9f0 | 14 | |
| HelGast95 | 74:12b9444a2fb4 | 15 | typedef struct { |
| HelGast95 | 74:12b9444a2fb4 | 16 | string id; /* Id */ |
| HelGast95 | 74:12b9444a2fb4 | 17 | float voltaje; /* Voltaje */ |
| HelGast95 | 74:12b9444a2fb4 | 18 | } BLEdata_t; |
| HelGast95 | 73:a91805f9e9f0 | 19 | |
| HelGast95 | 73:a91805f9e9f0 | 20 | DigitalOut led3Test(LED3); |
| HelGast95 | 73:a91805f9e9f0 | 21 | DigitalOut led4BLE(LED4); |
| HelGast95 | 73:a91805f9e9f0 | 22 | Serial pcSerial(USBTX, USBRX); // Abrimos conexión serial con el puerto USB |
| HelGast95 | 74:12b9444a2fb4 | 23 | DiscoveredCharacteristic testServiceptr; |
| HelGast95 | 73:a91805f9e9f0 | 24 | |
| HelGast95 | 73:a91805f9e9f0 | 25 | EventQueue eventQueue; |
| HelGast95 | 74:12b9444a2fb4 | 26 | Queue<BLEdata_t, 32> BLEqueue; |
| HelGast95 | 74:12b9444a2fb4 | 27 | MemoryPool<BLEdata_t, 32> BLEmpool; |
| mbed_official | 1:72c60abef7e7 | 28 | |
| HelGast95 | 73:a91805f9e9f0 | 29 | Thread threadLED(osPriorityAboveNormal1, 400); |
| HelGast95 | 74:12b9444a2fb4 | 30 | Thread threadSerial(osPriorityAboveNormal2, 2500); |
| HelGast95 | 74:12b9444a2fb4 | 31 | Thread threadBLE(osPriorityRealtime3, 1000); |
| HelGast95 | 73:a91805f9e9f0 | 32 | |
| HelGast95 | 73:a91805f9e9f0 | 33 | /** |
| HelGast95 | 73:a91805f9e9f0 | 34 | * Tarea encargada de parpadear un LED continuamente |
| HelGast95 | 73:a91805f9e9f0 | 35 | */ |
| HelGast95 | 73:a91805f9e9f0 | 36 | void blinkLED3() { |
| HelGast95 | 73:a91805f9e9f0 | 37 | while(true) { |
| HelGast95 | 73:a91805f9e9f0 | 38 | led3Test = !led3Test; |
| HelGast95 | 74:12b9444a2fb4 | 39 | wait(0.8); |
| HelGast95 | 73:a91805f9e9f0 | 40 | } |
| HelGast95 | 73:a91805f9e9f0 | 41 | } |
| HelGast95 | 73:a91805f9e9f0 | 42 | |
| HelGast95 | 73:a91805f9e9f0 | 43 | /** |
| HelGast95 | 73:a91805f9e9f0 | 44 | * Método encargado de enviar un string por el puerto serie char a char |
| HelGast95 | 73:a91805f9e9f0 | 45 | */ |
| HelGast95 | 73:a91805f9e9f0 | 46 | void sendCharArrayToSerial(char const *array, Serial *serial) { |
| HelGast95 | 74:12b9444a2fb4 | 47 | uint32_t i = 0; |
| HelGast95 | 73:a91805f9e9f0 | 48 | while(array[i] != '\0') { |
| HelGast95 | 73:a91805f9e9f0 | 49 | serial->putc(array[i]); |
| HelGast95 | 73:a91805f9e9f0 | 50 | i++; |
| HelGast95 | 73:a91805f9e9f0 | 51 | } |
| HelGast95 | 73:a91805f9e9f0 | 52 | serial->putc('\0'); |
| HelGast95 | 73:a91805f9e9f0 | 53 | } |
| mbed_official | 1:72c60abef7e7 | 54 | |
| HelGast95 | 73:a91805f9e9f0 | 55 | /** |
| HelGast95 | 74:12b9444a2fb4 | 56 | * Thread encargado de enviar JSONs por el puerto serie |
| HelGast95 | 73:a91805f9e9f0 | 57 | */ |
| HelGast95 | 73:a91805f9e9f0 | 58 | void sendJsonOverSerial() { |
| HelGast95 | 74:12b9444a2fb4 | 59 | picojson::object event; |
| HelGast95 | 74:12b9444a2fb4 | 60 | char tmp[50]; // Vble auxiliar para el tratamiento de cadenas de char. |
| HelGast95 | 74:12b9444a2fb4 | 61 | string str; |
| HelGast95 | 74:12b9444a2fb4 | 62 | char final = END_OF_JSON; |
| HelGast95 | 73:a91805f9e9f0 | 63 | |
| HelGast95 | 74:12b9444a2fb4 | 64 | while(true) { |
| HelGast95 | 74:12b9444a2fb4 | 65 | // Esperamos a un mensaje en la cola |
| HelGast95 | 74:12b9444a2fb4 | 66 | osEvent evt = BLEqueue.get(); |
| HelGast95 | 74:12b9444a2fb4 | 67 | if (evt.status == osEventMessage) { |
| HelGast95 | 74:12b9444a2fb4 | 68 | BLEdata_t *BLEdata = (BLEdata_t*) evt.value.p; |
| HelGast95 | 74:12b9444a2fb4 | 69 | |
| HelGast95 | 74:12b9444a2fb4 | 70 | printf("\r\nDato recibido BLE\r\n"); |
| HelGast95 | 74:12b9444a2fb4 | 71 | event["id"] = picojson::value(BLEdata->id); |
| HelGast95 | 74:12b9444a2fb4 | 72 | printf("Id: %s\r\n", BLEdata->id.c_str()); |
| HelGast95 | 74:12b9444a2fb4 | 73 | str = "Voltaje"; |
| HelGast95 | 74:12b9444a2fb4 | 74 | event["type"] = picojson::value(str); |
| HelGast95 | 74:12b9444a2fb4 | 75 | event["data"] = picojson::value(BLEdata->voltaje); |
| HelGast95 | 73:a91805f9e9f0 | 76 | |
| HelGast95 | 74:12b9444a2fb4 | 77 | BLEmpool.free(BLEdata); |
| HelGast95 | 74:12b9444a2fb4 | 78 | |
| HelGast95 | 74:12b9444a2fb4 | 79 | printf("Se serializa el string\r\n"); |
| HelGast95 | 74:12b9444a2fb4 | 80 | str = picojson::value(event).serialize(); |
| HelGast95 | 74:12b9444a2fb4 | 81 | |
| HelGast95 | 74:12b9444a2fb4 | 82 | // Convertimos el string a char * |
| HelGast95 | 74:12b9444a2fb4 | 83 | strncpy(tmp, str.c_str(), sizeof(tmp)); |
| HelGast95 | 74:12b9444a2fb4 | 84 | strncat(tmp, &final, sizeof(final)); // Añadimos el caracter al final |
| HelGast95 | 74:12b9444a2fb4 | 85 | tmp[sizeof(tmp) - 1] = 0; |
| HelGast95 | 74:12b9444a2fb4 | 86 | |
| HelGast95 | 74:12b9444a2fb4 | 87 | printf("Se envia un evento por el puesto serie\r\n"); |
| HelGast95 | 74:12b9444a2fb4 | 88 | sendCharArrayToSerial(tmp, &pcSerial); |
| HelGast95 | 74:12b9444a2fb4 | 89 | } |
| HelGast95 | 75:6606a580ebc4 | 90 | |
| HelGast95 | 75:6606a580ebc4 | 91 | wait(1); |
| HelGast95 | 74:12b9444a2fb4 | 92 | } |
| HelGast95 | 73:a91805f9e9f0 | 93 | } |
| HelGast95 | 73:a91805f9e9f0 | 94 | |
| HelGast95 | 74:12b9444a2fb4 | 95 | void scanCallback(const Gap::AdvertisementCallbackParams_t *params) { |
| HelGast95 | 73:a91805f9e9f0 | 96 | if (params->peerAddr[0] != 0x8E) return; |
| HelGast95 | 73:a91805f9e9f0 | 97 | printf("adv peerAddr[%02x %02x %02x %02x %02x %02x] rssi %d, isScanResponse %u, AdvertisementType %u\r\n", |
| HelGast95 | 73:a91805f9e9f0 | 98 | params->peerAddr[5], params->peerAddr[4], params->peerAddr[3], params->peerAddr[2], params->peerAddr[1], params->peerAddr[0], |
| HelGast95 | 73:a91805f9e9f0 | 99 | params->rssi, params->isScanResponse, params->type); |
| HelGast95 | 73:a91805f9e9f0 | 100 | |
| HelGast95 | 73:a91805f9e9f0 | 101 | BLE::Instance().gap().connect(params->peerAddr, Gap::ADDR_TYPE_RANDOM_STATIC, NULL, NULL); |
| HelGast95 | 73:a91805f9e9f0 | 102 | } |
| mbed_official | 1:72c60abef7e7 | 103 | |
| HelGast95 | 73:a91805f9e9f0 | 104 | void serviceDiscoveryCallback(const DiscoveredService *service) { |
| HelGast95 | 73:a91805f9e9f0 | 105 | if (service->getUUID().shortOrLong() == UUID::UUID_TYPE_SHORT) { |
| HelGast95 | 73:a91805f9e9f0 | 106 | printf("S UUID-%x attrs[%u %u]\r\n", service->getUUID().getShortUUID(), service->getStartHandle(), service->getEndHandle()); |
| HelGast95 | 73:a91805f9e9f0 | 107 | } else { |
| HelGast95 | 73:a91805f9e9f0 | 108 | printf("S UUID-"); |
| HelGast95 | 73:a91805f9e9f0 | 109 | const uint8_t *longUUIDBytes = service->getUUID().getBaseUUID(); |
| HelGast95 | 73:a91805f9e9f0 | 110 | for (unsigned i = 0; i < UUID::LENGTH_OF_LONG_UUID; i++) { |
| HelGast95 | 73:a91805f9e9f0 | 111 | printf("%02x", longUUIDBytes[i]); |
| HelGast95 | 73:a91805f9e9f0 | 112 | } |
| HelGast95 | 73:a91805f9e9f0 | 113 | printf(" attrs[%u %u]\r\n", service->getStartHandle(), service->getEndHandle()); |
| HelGast95 | 73:a91805f9e9f0 | 114 | } |
| HelGast95 | 73:a91805f9e9f0 | 115 | } |
| HelGast95 | 73:a91805f9e9f0 | 116 | |
| HelGast95 | 73:a91805f9e9f0 | 117 | void characteristicDiscoveryCallback(const DiscoveredCharacteristic *characteristicP) { |
| HelGast95 | 73:a91805f9e9f0 | 118 | printf(" C UUID-%x valueAttr[%u] props[%x]\r\n", characteristicP->getUUID().getShortUUID(), characteristicP->getValueHandle(), (uint8_t)characteristicP->getProperties().broadcast()); |
| HelGast95 | 74:12b9444a2fb4 | 119 | if (characteristicP->getUUID().getShortUUID() == 0xa001) { |
| HelGast95 | 73:a91805f9e9f0 | 120 | testServiceptr = *characteristicP; |
| HelGast95 | 73:a91805f9e9f0 | 121 | serviceDiscovered = true; |
| HelGast95 | 73:a91805f9e9f0 | 122 | } |
| HelGast95 | 73:a91805f9e9f0 | 123 | } |
| HelGast95 | 73:a91805f9e9f0 | 124 | |
| HelGast95 | 73:a91805f9e9f0 | 125 | void discoveryTerminationCallback(Gap::Handle_t connectionHandle) { |
| HelGast95 | 73:a91805f9e9f0 | 126 | printf("terminated SD for handle %u\r\n", connectionHandle); |
| HelGast95 | 73:a91805f9e9f0 | 127 | } |
| HelGast95 | 73:a91805f9e9f0 | 128 | |
| HelGast95 | 73:a91805f9e9f0 | 129 | void connectionCallback(const Gap::ConnectionCallbackParams_t *params) { |
| HelGast95 | 73:a91805f9e9f0 | 130 | if (params->role == Gap::CENTRAL) { |
| HelGast95 | 73:a91805f9e9f0 | 131 | BLE::Instance().gattClient().onServiceDiscoveryTermination(discoveryTerminationCallback); |
| HelGast95 | 73:a91805f9e9f0 | 132 | BLE::Instance().gattClient().launchServiceDiscovery(params->handle, serviceDiscoveryCallback, characteristicDiscoveryCallback, 0xA000, 0xA001); |
| HelGast95 | 73:a91805f9e9f0 | 133 | } |
| HelGast95 | 73:a91805f9e9f0 | 134 | } |
| mbed_official | 1:72c60abef7e7 | 135 | |
| mbed_official | 1:72c60abef7e7 | 136 | void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params) |
| mbed_official | 1:72c60abef7e7 | 137 | { |
| HelGast95 | 73:a91805f9e9f0 | 138 | /* Si se desconecta el dispositivo, volvemos a entrar en estado Advertising*/ |
| HelGast95 | 73:a91805f9e9f0 | 139 | printf("Desconectado. Se comienza la fase de escaneo de nuevo\n\r"); |
| HelGast95 | 73:a91805f9e9f0 | 140 | serviceDiscovered = false; |
| HelGast95 | 74:12b9444a2fb4 | 141 | BLE::Instance().gap().startScan(scanCallback); |
| mbed_official | 1:72c60abef7e7 | 142 | } |
| HelGast95 | 75:6606a580ebc4 | 143 | |
| HelGast95 | 73:a91805f9e9f0 | 144 | void onDataReadClientCallback(const GattReadCallbackParams *response) { |
| HelGast95 | 73:a91805f9e9f0 | 145 | if (response->handle == testServiceptr.getValueHandle()) { |
| HelGast95 | 74:12b9444a2fb4 | 146 | printf("\r\n\r\nonDataReadClientCallback: handle %u, offset %u, len %u\r\n", response->handle, response->offset, response->len); |
| HelGast95 | 73:a91805f9e9f0 | 147 | for (unsigned index = 0; index < response->len; index++) { |
| HelGast95 | 73:a91805f9e9f0 | 148 | printf("[%02x]", response->data[index]); |
| HelGast95 | 73:a91805f9e9f0 | 149 | } |
| HelGast95 | 73:a91805f9e9f0 | 150 | printf("\r\n"); |
| HelGast95 | 75:6606a580ebc4 | 151 | printf("Que pasa\r\n"); |
| HelGast95 | 75:6606a580ebc4 | 152 | |
| HelGast95 | 74:12b9444a2fb4 | 153 | BLEdata_t *BLEdata = BLEmpool.alloc(); |
| HelGast95 | 75:6606a580ebc4 | 154 | printf("Eyyyyy\r\n"); |
| HelGast95 | 74:12b9444a2fb4 | 155 | int r = rand() % 500; |
| HelGast95 | 75:6606a580ebc4 | 156 | printf("Eyyyyy1.5\r\n"); |
| HelGast95 | 74:12b9444a2fb4 | 157 | char str[12]; |
| HelGast95 | 75:6606a580ebc4 | 158 | printf("Eyyyyy1.6\r\n"); |
| HelGast95 | 74:12b9444a2fb4 | 159 | sprintf(str, "%d", r); |
| HelGast95 | 75:6606a580ebc4 | 160 | printf("Eyyyyy1.7\r\n"); |
| HelGast95 | 74:12b9444a2fb4 | 161 | BLEdata->id = str; |
| HelGast95 | 75:6606a580ebc4 | 162 | printf("Eyyyyy2\r\n"); |
| HelGast95 | 74:12b9444a2fb4 | 163 | uint16_t tensionaux; |
| HelGast95 | 74:12b9444a2fb4 | 164 | tensionaux = ((response->data[1]) << 8) + (response->data[0]); |
| HelGast95 | 75:6606a580ebc4 | 165 | printf("Eyyyyy2.1\r\n"); |
| HelGast95 | 75:6606a580ebc4 | 166 | BLEdata->voltaje = (tensionaux * 1.0 )/100; |
| HelGast95 | 75:6606a580ebc4 | 167 | printf("Eyyyyy2.2\r\n"); |
| HelGast95 | 74:12b9444a2fb4 | 168 | BLEqueue.put(BLEdata); |
| HelGast95 | 75:6606a580ebc4 | 169 | printf("Eyyyyy3\r\n"); |
| mbed_official | 1:72c60abef7e7 | 170 | } |
| mbed_official | 1:72c60abef7e7 | 171 | } |
| mbed_official | 1:72c60abef7e7 | 172 | |
| HelGast95 | 73:a91805f9e9f0 | 173 | /** |
| HelGast95 | 73:a91805f9e9f0 | 174 | * Esta función se llama si ha habido algún error en el proceso de inicialización del BLE |
| HelGast95 | 73:a91805f9e9f0 | 175 | */ |
| HelGast95 | 73:a91805f9e9f0 | 176 | void onBleInitError(BLE &ble, ble_error_t error) { |
| HelGast95 | 73:a91805f9e9f0 | 177 | printf("Ha ocurrido un error al inicializar la configuracion del BLE\n"); |
| mbed_official | 1:72c60abef7e7 | 178 | } |
| mbed_official | 1:72c60abef7e7 | 179 | |
| HelGast95 | 73:a91805f9e9f0 | 180 | void printMacAddress() { |
| mbed_official | 43:fb2855f7754b | 181 | /* Print out device MAC address to the console*/ |
| mbed_official | 43:fb2855f7754b | 182 | Gap::AddressType_t addr_type; |
| mbed_official | 43:fb2855f7754b | 183 | Gap::Address_t address; |
| mbed_official | 43:fb2855f7754b | 184 | BLE::Instance().gap().getAddress(&addr_type, address); |
| mbed_official | 43:fb2855f7754b | 185 | printf("DEVICE MAC ADDRESS: "); |
| mbed_official | 43:fb2855f7754b | 186 | for (int i = 5; i >= 1; i--){ |
| mbed_official | 43:fb2855f7754b | 187 | printf("%02x:", address[i]); |
| mbed_official | 43:fb2855f7754b | 188 | } |
| mbed_official | 43:fb2855f7754b | 189 | printf("%02x\r\n", address[0]); |
| mbed_official | 43:fb2855f7754b | 190 | } |
| mbed_official | 43:fb2855f7754b | 191 | |
| HelGast95 | 73:a91805f9e9f0 | 192 | /** |
| HelGast95 | 73:a91805f9e9f0 | 193 | * Callback triggered when the ble initialization process has finished |
| HelGast95 | 73:a91805f9e9f0 | 194 | */ |
| mbed_official | 1:72c60abef7e7 | 195 | void bleInitComplete(BLE::InitializationCompleteCallbackContext *params) |
| mbed_official | 1:72c60abef7e7 | 196 | { |
| mbed_official | 1:72c60abef7e7 | 197 | BLE& ble = params->ble; |
| mbed_official | 1:72c60abef7e7 | 198 | ble_error_t error = params->error; |
| mbed_official | 1:72c60abef7e7 | 199 | |
| mbed_official | 1:72c60abef7e7 | 200 | if (error != BLE_ERROR_NONE) { |
| HelGast95 | 73:a91805f9e9f0 | 201 | /* In case of error, forward the error handling to onBleInitError */ |
| mbed_official | 1:72c60abef7e7 | 202 | onBleInitError(ble, error); |
| mbed_official | 1:72c60abef7e7 | 203 | return; |
| mbed_official | 1:72c60abef7e7 | 204 | } |
| mbed_official | 1:72c60abef7e7 | 205 | |
| HelGast95 | 73:a91805f9e9f0 | 206 | /* Ensure that it is the default instance of BLE */ |
| HelGast95 | 73:a91805f9e9f0 | 207 | if(ble.getInstanceID() != BLE::DEFAULT_INSTANCE) { |
| mbed_official | 1:72c60abef7e7 | 208 | return; |
| mbed_official | 1:72c60abef7e7 | 209 | } |
| HelGast95 | 73:a91805f9e9f0 | 210 | |
| HelGast95 | 73:a91805f9e9f0 | 211 | ble.gap().onConnection(connectionCallback); |
| mbed_official | 1:72c60abef7e7 | 212 | ble.gap().onDisconnection(disconnectionCallback); |
| mbed_official | 1:72c60abef7e7 | 213 | |
| HelGast95 | 73:a91805f9e9f0 | 214 | ble.gattClient().onDataRead(onDataReadClientCallback); |
| mbed_official | 1:72c60abef7e7 | 215 | |
| HelGast95 | 73:a91805f9e9f0 | 216 | ble.gap().setScanParams(500, 400); |
| HelGast95 | 75:6606a580ebc4 | 217 | ble.gap().startScan(scanCallback); |
| mbed_official | 1:72c60abef7e7 | 218 | } |
| mbed_official | 1:72c60abef7e7 | 219 | |
| mbed_official | 1:72c60abef7e7 | 220 | void scheduleBleEventsProcessing(BLE::OnEventsToProcessCallbackContext* context) { |
| mbed_official | 1:72c60abef7e7 | 221 | BLE &ble = BLE::Instance(); |
| mbed_official | 10:ac3615194d04 | 222 | eventQueue.call(Callback<void()>(&ble, &BLE::processEvents)); |
| HelGast95 | 73:a91805f9e9f0 | 223 | } |
| HelGast95 | 73:a91805f9e9f0 | 224 | |
| HelGast95 | 73:a91805f9e9f0 | 225 | void readVoltageValue() { |
| HelGast95 | 73:a91805f9e9f0 | 226 | BLE &ble = BLE::Instance(); |
| HelGast95 | 73:a91805f9e9f0 | 227 | if (serviceDiscovered && !ble.gattClient().isServiceDiscoveryActive()) { |
| HelGast95 | 73:a91805f9e9f0 | 228 | testServiceptr.read(); |
| HelGast95 | 73:a91805f9e9f0 | 229 | } |
| mbed_official | 1:72c60abef7e7 | 230 | } |
| mbed_official | 1:72c60abef7e7 | 231 | |
| HelGast95 | 73:a91805f9e9f0 | 232 | void BLEServiceManagment() { |
| HelGast95 | 75:6606a580ebc4 | 233 | eventQueue.call_every(2000, readVoltageValue); |
| HelGast95 | 73:a91805f9e9f0 | 234 | |
| mbed_official | 1:72c60abef7e7 | 235 | BLE &ble = BLE::Instance(); |
| HelGast95 | 73:a91805f9e9f0 | 236 | ble.onEventsToProcess(scheduleBleEventsProcessing); |
| mbed_official | 1:72c60abef7e7 | 237 | ble.init(bleInitComplete); |
| HelGast95 | 73:a91805f9e9f0 | 238 | |
| mbed_official | 10:ac3615194d04 | 239 | eventQueue.dispatch_forever(); |
| HelGast95 | 73:a91805f9e9f0 | 240 | } |
| mbed_official | 1:72c60abef7e7 | 241 | |
| HelGast95 | 73:a91805f9e9f0 | 242 | int main() { |
| HelGast95 | 74:12b9444a2fb4 | 243 | srand(time(NULL)); |
| HelGast95 | 73:a91805f9e9f0 | 244 | threadLED.start(blinkLED3); |
| HelGast95 | 73:a91805f9e9f0 | 245 | threadBLE.start(BLEServiceManagment); |
| HelGast95 | 74:12b9444a2fb4 | 246 | threadSerial.start(sendJsonOverSerial); |
| HelGast95 | 74:12b9444a2fb4 | 247 | |
| HelGast95 | 73:a91805f9e9f0 | 248 | threadLED.join(); |
| HelGast95 | 73:a91805f9e9f0 | 249 | threadBLE.join(); |
| HelGast95 | 74:12b9444a2fb4 | 250 | threadSerial.join(); |
| HelGast95 | 73:a91805f9e9f0 | 251 | |
| HelGast95 | 75:6606a580ebc4 | 252 | while(true) { |
| HelGast95 | 75:6606a580ebc4 | 253 | wait(100); |
| HelGast95 | 75:6606a580ebc4 | 254 | } |
| mbed_official | 1:72c60abef7e7 | 255 | return 0; |
| HelGast95 | 73:a91805f9e9f0 | 256 | } |