In some cases, you may want to write a value to a Bluetooth LE device’s characteristic as opposed to or in addition to reading its value. Core Bluetooth allows us to write to a peripheral’s specific characteristic using an instance of the Data class. Depending on the method used, there may also be a callback to notify of success or failure.
- [Instructor] So, now that we've connected to a peripheral…and discovered it's services and drilled down…into its characteristics, now we're going to look at…writing a value to a characteristic on the peripheral.…There's different types of characteristics…you may need to write to for your given device.…Sometimes it's to store data.…Other times it's to enable something or disable something…or otherwise configure the device.…To write to a peripheral, we're going to send…a data instance that represents whatever data…we're trying to store on the peripheral.…
That could be bytes or string.…It depends on the device and the characteristic in question.…Also, when you write data to a peripheral,…there's two options.…You can write with or without a response.…You have to check the properties for which one they support,…and use the appropriate parameter in the call.…We'll go over both cases.…So, in our code, we've discovered our service,…and then when we found the light detection sensor,…we discovered the characteristics.…
- Bluetooth Low Energy (BLE) basics
- Core Bluetooth key classes
- Scanning for peripherals
- Discovering services and characteristics
- Writing to a characteristic
- Reconnecting to peripherals
- Apps as peripherals
Skill Level Intermediate
1. BLE Basics
2. Scanning, Connecting, and Discovering
3. Writing to a Characteristic
Adding additional features10m 43s
4. An App as a Peripheral
Next steps1m 7s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.