How To Design With Bluetooth Mesh
You can "git" a workspace will all of these files at https://github.com/iotexpert/MouserVTWBluetoothMesh or email@example.com:iotexpert/MouserVTWBluetoothMesh.git
In this lesson I will show you how to find and use code examples. I’ll then provision a motion sensor into my Bluetooth Mesh network and test. Here are the steps:
- How to Find the Code Examples
- How to Import the Code Examples
- Explore the Code Examples
- How to Use a Code Example
- Provision the Motion Sensor Into the Network
- Test the Motion Sensor
How to Find the Code Examples
In the ModusToolbox Quick Panel pick “Search Online for Code Examples”
You will find yourself in a web browser on the cypressemiconductorco GitHub site.
Click on the link “Bluetooth SDK Examples”
You can look around on the website at the examples. Or …
How to Import the Code Examples
Click the “Clone or download” button. This will give you this window which has the SSH or HTTPS address of the site.
Copy the location of the github repo “firstname.lastname@example.org:cypresssemiconductorco/Code-Examples-BT-SDK-for-ModusToolbox.git”. Then go back to the Workspace Explorer. Right click and select “Import…”
Choose Git–>Projects from Git
Select “Clone URI” (so you can get the examples from the Internet)
Paste in the URI (which you copied from the web browser) Then press Next–>
Pick out the master branch.
You will now need to tell Eclipse where you want it to save the repository on your local machine. I let it select the default location and press Next –>
To make things easy, you can then import that directory full of goodness into your Workspace. An excellent developer I know says that Code is all of the documentation you need. Which means that it is nice to be able to browse the code in a good editor.
Explore the Code Examples
Now you should have the folder “Code-Examples-BT-20819A1-1.0-for-ModusToolbox” inside of your Workspace.
If you double click the “BT-SDK-1.2-Code-Examples.pdf” you will get a description of them all
You can walk through them using the Workspace Explorer. Notice that we created examples for many of the Bluetooth Mesh Models.
Example Peer Apps
We had a problem with Peer Apps in the SDK1.2 release and this was fixed by adding the Peer Apps to the Example Projects.
How to use a Code Example
To create a project from one of the code examples, start by choosing “File->New->ModusToolbox IDE Application”
Pick the correct development kit “CYBT-213043-MESH”
Navigate to the file “modus.mk” of the example you want. This will be in the directory on your computer where you cloned the GitHub repository.
After doing the Import you will have that example as a Starter Application. Notice that they have an asterisks beside the name. Type the name of your application if you want to change it. In this case I pick “VTW_Mesh_SensorMotion”. Then press “Next->”
Now you will have the application in the Workspace.
You can now press “VTW_Mesh_SensorMotion Build + Program”
And you will end up with this in your console after sweet Success!!!
Provision the Motion Sensor into the Network
I now have a board programmed with the Motion Sensor Application. Seems like that it will be a good idea to provision it into the network and see if it is doing anything. Press “Scan Unprovisioned”.
Once I see my device, I’ll stop scanning and then press “Provision and configure”. After a minute our tool will tell you that it is done!
Test the Motion Sensor
You can request the state of the sensor by clicking “Control” and then picking the motion sensor. Now press the “Get” button for the sensor and you will see that the sensor is graced with my presence.
Each time I click “Get” you can see the transaction happening on the development kit.