13. Library functions
13.1. Library constructor
To start using Waspmote 4-20 mA library, an object from class
, is created inside Waspmote 4-20 mA library and it is public to all libraries. It is used through this guide to
currentLoopBoard
show how Waspmote 4-20 mA library works. When creating this constructor, all the variables are defined with an initial value
by default.
13.2. Switching the board on
The 4-20 mA Board includes a 12 V output that can be used to supply sensors, and can be controlled from the library functions,
by a digital pin of Waspmote. The electronic measurement circuits use the 5 V power (so it is always mandatory to switch this
option on), and is necessary to switch on this power supply before getting data from the sensors.
On the other hand, it is only necessary to switch the 12 V on when we want to power 3rd party sensors.
Example of use:
{
// Sets the 5 V switch ON
currentLoopBoard.ON(SUPPLY5V);
delay(100);
// Sets the 12 V switch ON
currentLoopBoard.ON(SUPPLY12V);
delay(100);
}
See an example of use here:
http://www.libelium.com/development/waspmote/examples/4-20ma-01-current-loop-basic-example
13.3. Switching the board off
This function can be used to switch OFF the power supplies of the 4-20 mA Board. The 12 V and 5 V power supplies must be
switched off separately as shown in the next example.
Example of use:
{
// Sets the 5 V switch OFF
currentLoopBoard.OFF(SUPPLY5V);
delay(100);
// Sets the 12 V switch OFF
currentLoopBoard.OFF(SUPPLY12V);
delay(100);
}
must be created. This object, called
currentLoop
-31-
Library functions
v7.1
Need help?
Do you have a question about the Waspmote and is the answer not in the manual?