The Pin State Monitor module is one of the most useful modules 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.
Arduino IDE Functions
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:
Enabling Bluetooth Communication
For evive and Arduino Mega, Uno and Nano
Here Baud_Rate is the baud rate set for the Bluetooth module. With evive, you normally get 115200 baud rate modules.
In place of Bluetooth_Name enter name that you want to keep for Bluetooth of ESP32. Default name given in the library is “MyEsp32”.
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.
PictoBlox (Scratch) Blocks
In order to send the status of digital and analog pins of your board copy code as per your board from below mentioned board-wise codes or navigate to “Files>>Examples>>Dabble>>” and open “PinStateMonitor” for your board.
Uno and NanoESP32
The above script only works with evive, for working with Mega, Uno or Nano replace head block “when evive starts up” with start up block corresponding to your board and also start add set baud rate block. Pictoblox currently does not support ESP32; however, it will be added soon.