4 – Main Block

Finally,  we come to the final tutorial for Panther Language. The Main Block is the main component of Panther Language. The Main block will include: binding sensors to initialized pin board headers and giving upper and lower threshold values to each sensor.

You initialize the function by calling “Main,” you can see what it looks like in following code snippet.

void Main ()
Sensor <sensor-name> = new <sensor-brand-name>();
<sensor-name>.setUpperBound = 120; // you give any value instead of 120.
<sensor-name>.setLowerBound = 20; // you give any value instead of 20.

Before explaining everything inside the main function, we would like to give brief information about sensors. If you know what sensor is and what is good for, you can skip Part 1.a to save time.

Before we explain what occurs in the main function, we will give a brief overview on sensors. You may skip Part 1.a if you do not need this tutorial.

Part 1.a

Following text was taken from wikipedia.org

In the broadest definition, a sensor is an electronic component, module, or subsystem whose purpose is to detect events or changes in its environment and send the information to other electronics, frequently a computer processor. A sensor is always used with other electronics, whether as simple as a light or as complex as a computer.

Sensors are used in everyday objects such as touch-sensitive elevator buttons (tactile sensor) and lamps which dim or brighten by touching the base, besides innumerable applications of which most people are never aware. With advances in micromachinery and easy-to-use microcontroller platforms, the uses of sensors have expanded beyond the traditional fields of temperature, pressure or flow measurement,[1] for example into MARG sensors. Moreover, analog sensors such as potentiometers and force-sensing resistors are still widely used. Applications include manufacturing and machinery, airplanes and aerospace, cars, medicine, robotics and many other aspects of our day-to-day life.


SparkFun Atmospheric Sensor – BME280

Each sensor has a specific purpose. Prior to buying any sensor, you should consider the functionality of your intended project in order to prevent erroneous purchases.

Additionally, every sensor has interface pins that communicate with your IoT boards. Therefore, it’s better to consult our Proviz software tutorials.

If you think you have questions about sensors, IoT boards, binding operations, pin headers or anything, you can send us email or you can join our slack community to ask us any questions.

Now back to our Main Block tutorial, I am going to introduce a new concept. Every sensor in the Proviz software has upper and lower bound threshold values. These values are useful for creating alarm based applications.

Let’s consider a temperature measurement application. You have one temperature measurement sensor and an Arduino IoT board. You want to make an application that triggers an alarm based on a temperature value. If the temperature drops below the specified lower bound threshold or exceeds the upper bound threshold, your application will trigger an alarm to let you know.

Before deciding threshold values, we should declare our sensor as such:

Sensor <sensor-name> = new <sensor-brand-name>();

Sensor declaration should start with the term “Sensor”. This will let the Panther Language compiler know that you are initializing a sensor. You will then give the Sensor a unique name.

After writing “=” sign, you should write the term “new” to indicate that this sensor is new to our system.

Following your declaration of “new”, you will write the sensor’s brand name. Currently, Proviz supports the following brands.

For now, we support these sensors on our Proviz software:
Sensor Name sensor-brand-name
HC-SR04 Ranging Detector Mod Distance Sensor SonarSensor
SparkFun Atmospheric Sensor Breakout – BME280 BME280Sensor

You can refer to the above table to decide which sensor brand name you should write for your sensors. For example, if you have SparkFun Atmospheric Sensor Breakout – BME280 sensor, you should write “BME280Sensor” in the <sensor-brand-name> field.

See the following example:

Sensor myTemperatureSensor = new BME280Sensor();

Now it’s time to give threshold values for enabling the threshold alarm.

<sensor-name>.setUpperBound = 120; // you give any value instead of 120.
<sensor-name>.setLowerBound = 20; // you give any value instead of 20.

Above code snippet shows how to write give threshold values to your sensors. As you can see, you simply need to write your sensor variable name and either “.setUpperBound =” or “.setLowerBound=”. After that, you should provide your threshold value.

So far, you have created and initialized your sensor and you have provided upper and lower bound threshold values. Now it’s time to bind your pin variable name, which you created in lesson 2, with your sensor.

The syntax for binding pins with sensors is very simple. See following code snippet.


If you provide your inputs, it will look like this:


This concludes our Panther Language tutorials. It was a pleasure to teach you about Proviz and how to create your own applications.

We would love to hear your experience about our tutorials and our products, you can reach us via our contact form or through the slack community.

We would like to finish our Panther Language tutorial series with an example of one complete code. You can see it in following code snippet.

Pin pinBME280AnalogPin = new AnalogPin(0);

void Pinconfiguration ()
pinBME280AnalogPin = OUTPUT 

void Main ()
Sensor temperatureSensor = new BME280Sensor();
temperatureSensor.setUpperBound = 30; 
temperatureSensor.setLowerBound = 5; 




Leave a reply

Your email address will not be published.

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>