Mobile phone Bluetooth controls the lights on the BlueRNG development board (source code + .hex file)[Copy link]
This post was last edited by elike on 2018-1-24 19:18 Basic function description. After the program is written, you can connect to the BLE server in the lightblue client on your phone. After the connection is successful, LED1 will light up. Then, when you send 'x' to BlueNRG with your phone, the blue light of LED3 will light up. When you send 'x' again, the blue light of LED3 will go out. When you send 'y', LED2 will light up. When you send it again, LED2 will go out. In this way, you can use your phone to send different letters via Bluetooth to control the on and off of LED2 and LED3. (Attachment server.hex can be burned directly) [attach]342418 [/attach] [attach]342419 [/attach] [attach]342420 [/attach] 1. Set up the working environment TrueSTUDIO + secureCRT, and use the BlueRNG-1Flasher_GUI that comes with the burning tool. Since this program is modified from the Blue_chat in the example program, let's first analyze the source code structure. [attach]342421 [/attach] [attach]342423 [/attach] The code we need to write is marked in the blue box. The other files are project files for different platforms, including EWARM, MDK-ARM and TrueSTUDIO. The following is only for TrueSTUDIO, so we can just copy the files in the following three directories: ./inc/*, ./src/*, ./TrueSTUDIO/BlueNRG-1/*. However, the source code also has many dependent libraries, which are all placed in the BlueNRG-1_2 DK 2.6.0/Library folder. We just need to copy and configure them to the corresponding project files. For the convenience of modification, I created a new Projec folder, with Library and Project in the same directory. The project file structure is as follows.
The files in the yellow box are generated after compilation, so don't worry about them. Finally, the file configuration part can be modified in the project configuration, as shown in the figure.