No ACL setup yet! Denying access to everyone.
en:edu:zmitac:s2:iotn:ble1
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:edu:zmitac:s2:iotn:ble1 [2023/12/16 15:29] – [Loop function] ktokarz | en:edu:zmitac:s2:iotn:ble1 [2023/12/17 19:57] (current) – [Bluetooth Low Energy for STM32 - peripheral] ktokarz | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Bluetooth Low Energy for STM32 - peripheral ====== | + | ====== Bluetooth Low Energy for STM32 - peripheral |
| This laboratory shows the details of the example provided as part of the STM32duinoBLE library by Arduino. | This laboratory shows the details of the example provided as part of the STM32duinoBLE library by Arduino. | ||
| ===== Installing the library and importing the example ===== | ===== Installing the library and importing the example ===== | ||
| Line 29: | Line 29: | ||
| BLEByteCharacteristic switchCharacteristic(" | BLEByteCharacteristic switchCharacteristic(" | ||
| </ | </ | ||
| - | The number of characteristics in one service is limited to 512 by BLE specification. You can experiment on how many characteristics can be used in Arduino implementation.\\ | + | The characteristic defined in the example allows remote devices to read or write byte values. It is also possible to define characteristics which contain the text string. |
| + | < | ||
| + | BLECharacteristic textCharacteristic(" | ||
| + | </ | ||
| + | In the BLE specification, | ||
| The example program allows the remote device to control the state of the LED, so there is also a declaration of the " | The example program allows the remote device to control the state of the LED, so there is also a declaration of the " | ||
| < | < | ||
| Line 80: | Line 84: | ||
| </ | </ | ||
| < | < | ||
| - | To check if there is an active connection the state of " | + | To check if there is an active connection the state of " |
| - | The while loop is executed until the remote device decides to close the connection. | + | |
| < | < | ||
| // if a central is connected to peripheral: | // if a central is connected to peripheral: | ||
| Line 114: | Line 118: | ||
| - Add STM32duinoBLE library to the project. | - Add STM32duinoBLE library to the project. | ||
| - Replace the original blink code with the LED example, compile and execute. | - Replace the original blink code with the LED example, compile and execute. | ||
| - | - Add characteristics to existing service | + | - Add characteristics to existing service |
| - Add service and the characteristic to display texts (using serial port). | - Add service and the characteristic to display texts (using serial port). | ||
| + | Reading text value can be done with memcpy() function. | ||
| + | < | ||
| + | char buffer[10]; | ||
| + | memcpy(buffer, | ||
| + | </ | ||
| < | < | ||
en/edu/zmitac/s2/iotn/ble1.1702736940.txt.gz · Last modified: by ktokarz
