GY-63_MS5611/libraries/AnalogUVSensor/AnalogUVSensor.h

47 lines
859 B
C
Raw Normal View History

2021-09-29 11:06:47 -04:00
#pragma once
//
// FILE: AnalogUVSensor.h
// AUTHOR: Rob Tillaart
2023-01-22 13:19:42 -05:00
// VERSION: 0.1.4
2021-09-29 11:06:47 -04:00
// DATE: 2021-09-25
2022-10-28 15:40:39 -04:00
// PURPOSE: Arduino library for an analogue UV sensor.
2023-01-22 13:19:42 -05:00
// URL: https://github.com/RobTillaart/AnalogUVSensor
2021-09-29 11:06:47 -04:00
#include "Arduino.h"
2023-01-22 13:19:42 -05:00
#define ANALOG_UVSENSOR_LIB_VERSION (F("0.1.4"))
2021-09-29 11:06:47 -04:00
class AnalogUVSensor
{
public:
AnalogUVSensor();
2023-01-22 13:19:42 -05:00
// adjust ADC settings to your board!
2021-09-29 11:06:47 -04:00
void begin(uint8_t analogPin, float volts = 5.0, uint16_t maxADC = 1023);
float read(uint8_t times = 1);
2023-01-22 13:19:42 -05:00
float mV2index(uint16_t milliVolt); // for external ADC
2021-09-29 11:06:47 -04:00
char index2color(float index);
2023-01-22 13:19:42 -05:00
2021-09-29 11:06:47 -04:00
// POWER
void setPowerPin(uint8_t powerPin, bool invert = false);
2023-01-22 13:19:42 -05:00
void switchOff();
void switchOn();
2021-09-29 11:06:47 -04:00
private:
uint8_t _analogPin;
float _volts;
uint16_t _maxADC;
uint8_t _powerPin;
bool _invert;
};
2023-01-22 13:19:42 -05:00
// -- END OF FILE --