float uvIntensity = mapfloat(outputVoltage, 0.99, 2.8, 0.0, 15.0); //Convert
the voltage to a UV intensity level
SampleCode
/***************************************************
* UV Sensor v1.0-ML8511
* <http://www.dfrobot.com/index.php?route=product/product&product_id=1195&se
arch=uv&description=true>
***************************************************
* This example reads UV intensity from UV Sensor v1.0-ML8511.
*
* Created 2014-9-23
* By Phoebe <phoebe.wang@dfrobot.com>
* Modified 2014-9-23
* By Phoebe phoebe.wang@dfrobot.com>
*
* GNU Lesser General Public License.
* See <http://www.gnu.org/licenses/> for details.
* All above must be included in any redistribution
****************************************************/
/***********Notice and Trouble shooting***************
* 1.Connect ML8511 UV Sensor to Arduino A0
<http://www.dfrobot.com/wiki/index.php/File:SEN0175_Diagram.png>
* 2.This code is tested on Arduino Uno, Leonardo, Mega boards.
****************************************************/
int ReadUVintensityPin = A0; //Output from the sensor
void setup()
{
pinMode(ReadUVintensityPin, INPUT);