MistyGro API
C++ API for MistyGro's ESP32 controller based on the Arduino framework
Software
esp32_firmware
include
ldr.h
Go to the documentation of this file.
1
/*
2
* Copyright 2023 Myron Rodrigues
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#ifndef _LDR_H_
18
#define _LDR_H_
19
20
#include <Arduino.h>
21
22
#include "
adc.h
"
23
28
class
LDR
29
{
30
private
:
31
ADC
* adc_;
32
const
size_t
samples_;
33
34
public
:
41
LDR
(
int
samples,
ADC
*
adc
);
42
48
float
read_voltage
();
49
};
50
51
#endif
adc.h
ADC
Definition:
adc.h:28
LDR
Light dependent resistor wrapper.
Definition:
ldr.h:29
LDR::read_voltage
float read_voltage()
Read voltage from ADC for LDR. Make sure ADC is initialised before calling this method.
Definition:
ldr.cpp:21
LDR::LDR
LDR(int samples, ADC *adc)
Construct a new LDR object.
Definition:
ldr.cpp:19
adc
ADC adc
Definition:
main.cpp:28
Generated by
1.9.1