* ------ [4-20mA_01] Current Loop Basic Example --------
* Explanation: This sketch shows how to use the most important
* features of the 4-20 mA Current Loop Board in Waspmote. This
* standard is used to transmit information of sensor over long
* distances. Waspmote uses analog inputs for reading the sensor
* Copyright (C) 2014 Libelium Comunicaciones Distribuidas S.L.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* Implementation: Ahmad Saad
//Include this library for using current loop functions
//Instantiate currentLoop object in channel 1
// Power on the USB for viewing data in the serial monitor
// Sets the 5 V switch ON
// Get the sensor value in int format (0-1023)
int value = sensor.readChannel();
USB.print(“Int value read from channel 1: “);
// Get the sensor value as a voltage
float voltage = sensor.readVoltage();
USB.print(“Voltage value rad from channel 1: “);
// Get the sensor value as a current in mA
float current = sensor.readCurrent();
USB.print(“Current value read from channel 1: “);