It is time to put it all together. As we explained, we want to switch based on presence detection and only when the ambient light reaches a certain level. This is a code-only section. We will be walking through the code and will code some lines ourselves.
If you haven't already, write down or copy the device's Bluetooth address by running the runBluetoothDetectionExample(); one more time as we will be using this address to get a positive detection. When we have the address, we will be writing a couple of lines of code that run all the components we have looked at as a single application. Let's close all open tabs and only open the Main class. Comment the runBluetoothDetectionExample(); method and scroll to the bottom of the class, where we will be adding the following code:
/**
* Runs the application.
* @throws LcdSetupException When...