MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / read

Method read

libraries/AnalogUVSensor/AnalogUVSensor.cpp:32–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31
32float AnalogUVSensor::read(uint8_t times)
33{
34 uint32_t sum = 0;
35 if (times == 0) times = 1;
36 for (int i = 0; i < times; i++)
37 {
38 sum += analogRead(_analogPin);
39 }
40 uint16_t milliVolt = sum * (_volts * 1000.0) / (times * _maxADC);
41 return mV2index(milliVolt);
42}
43
44
45float AnalogUVSensor::mV2index(uint16_t milliVolt)

Callers 1

unittestFunction · 0.45

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.36