Pin State Monitor Module
This module allows you to remotely monitor the live status of devices and debug them by displaying the values of all the pins – both digital and analog. It has the following two display screens:
- Analog: This shows the values of the analog pins between 0 and 1023.
- Digital: This displays the states of the digital pins. These pins can either be at 1 or at 0.
You can switch between the two screens by sliding right or left.
The Pin State Monitor module is one of the most useful module to debug your sensors and calibrate them for your program. This module provides you the real-time status of all the digital and analog pins.
Digital Pins Monitor
This shows the values of all the digital pins states. The state is shown in the form of ON or OFF, where ON state means the state of the pin is HIGH (5V) and OFF state means the state of the pin is LOW (0V).
Analog Pins Monitor
This shows the analog value of the voltage on the analog input pins. The value is shown from 0 to 1023, which is mapped to the voltage from 0 to 5V.
For example is the value showing on the monitor is 512, then the voltage value will be approximately 5*(512/1023) = 2.5V.
Enabling Pin State Monitor
To enable the Pin State Monitor feature for the very first time, you have to upload the following script:
As you can see, there is a stack block named as “ enable pin state monitor” and its function is to enable the Pin State Monitor feature of Dabble.
To include the Pin Monitor module in the Arduino program, you have to include the following header:
After defining the above mention headers, you have to include the dabble library:
You can download the library from here:
Enabling Bluetooth Communication
To enable Bluetooth communication, you have to initialize serial communication using the following code:
Here Baud_Rate is the baud rate set for the Bluetooth module. With evive, you normally get 115200 baud rate modules.
Refreshing the data
To refresh the data that the device has got from the mobile app, you have to use the following line of code:
If you want to refresh the pin state in your app, you have to use the following functions to do it:
- PinState.sendDigitalData() : This function sends all the digital pin state to the app.
- PinState.sendAnalogData() : This functions sends all the analog pin state to the app.
You have to add a delay between sending data to the app. This delay should be greater than 20 microseconds to achieve smooth functionality of the module.