
In this tutorial we are going to read the values from a Pressure Sensor Adafruit MPRLS by using a Custom Code component in Visuino Pro.
Custom Code component in Visuino Pro allows us to add any Arduino code to the Visuino project.
Custom Code component in Visuino Pro is very useful if you need to add some sensor that is not yet supported in Visuino but you already have the code for it, or to just experimenting by adding your own code to the project.
Custom code in Visuino PRO is solving nearly 100% of all the missing functionality in Visuino Standard version.
More about Visuino Pro here
Here are also some very good tutorials on how to use a Custom Code component:
The MPRLS has a default I2C address of 0x18 and cannot be changed!
More here
Go to https://github.com/adafruit/Adafruit_MPRLS and download Adafruit_MPRLS Arduino Library
Extract the to your Arduino Libraries folder, usually it looks something like this: C:\Users\User\Documents\Arduino\libraries
You can also find the Path if you in Visuino click on the Menu>Arduino>Configure and see it under "Arduino Library Directory" (see attached screenshot)
Select "CustomCode1" and in the properties window select "Includes" and Click on the 3dots button
In the "Includes" window add this code:
#include
And Close the "Includes" window
Select "CustomCode1" and in the properties window select "Members" and Click on the 3dots button
In the "Members" window add this code:
double pressure_hPa;
Adafruit_MPRLS mpr;
And Close the "Members" window
Select "CustomCode1" and in the properties window select "On Init" and Click on the 3dots button
In the "On Init" window add this code:
mpr.begin();
And Close the "On Init" window
Select "CustomCode1" and in the properties window select "On Execute" and Click on the 3dots button
In the "On Execute" window add this code:
{
double pressure_hPa = mpr.readPressure();
Analog1.Send( pressure_hPa);
}
And Close the "On Execute" window


If you power the Arduino module, at the bottom click on the "Serial" Tab, make sure you selected the correct port and click "Connect" button. You should start to see the pressure values in the serial monitor.
Since the "ClockGenerator1" frequency is 1Hz we are getting values every second, you can adjust the Frequency of the "ClockGenerator1" in the properties window.
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable, you can download it here and open it in Visuino: https://www.visuino.eu
