The main idea of this demo is to be able to send commands from one device to another, it could be from a QN9080DK, a phone using our NXP application: IoT Toolbox or even an FRDM-KW41Z, this is possible because of the BLE protocol used in all our devices.
The end-device used is a QN9080DK, this board receives the message, does parsing and triggers a PWM function using the values sent from another device. This signal can be used in different applications, typically controlling smart lighting brightness and color, speed of motor controls and audio or video amplifiers. The goal of this demo is to implement a task for our FreeRTOS scheduler in order to be able to control a PWM while the BLE connection is still running and receive new incoming messages.
We only interpret ON, OFF and a string of values for our 3 signal outputs.
The string of values has to be in the following syntax: rXXX,gXXX,bXXX. An example of this could be r255,g130,b200.
The max value should be 255 in order to achieve 100% of the duty cycle, for this example, we are using is at 100 Hz.
The connection is not using pairing or bonding modes, so no device information is saved on the non-volatile memory due to this if the connection is lost we need to follow the initial connection procedure.
The amount of bytes that can be sent is limited by the macro: #define gAttMaxMtu_c in the ble_constants.h file from the project, we recommend to leave it as it is.
Useful documentation is available in the SDK previously downloaded: <SDK Installation folder>...\SDK_2.2.1_QN908XCDK\docs