lib Modulove
Library for building custom scripts for Modulove modules.
Toggle main menu visibility
Main Page
Classes
Class List
Class Index
Class Members
All
a
b
c
d
e
g
h
i
l
o
p
r
s
u
~
Functions
a
c
e
g
h
i
l
o
p
r
s
u
~
Variables
Enumerations
Files
File List
•
All
Classes
Files
Functions
Variables
Enumerations
Pages
Loading...
Searching...
No Matches
analog_input.h
Go to the documentation of this file.
1
11
#ifndef ANALOG_INPUT_H
12
#define ANALOG_INPUT_H
13
14
#include <Arduino.h>
15
16
namespace
modulove {
17
18
const
int
MAX_INPUT = (1 << 10) - 1;
// Max 10 bit analog read resolution.
19
20
class
AnalogInput
{
21
public
:
22
AnalogInput
() {}
23
~AnalogInput
() {}
24
30
void
Init
(uint8_t pin) {
31
pinMode(pin, INPUT);
32
pin_ = pin;
33
}
30
void
Init
(uint8_t pin) {
…
}
34
39
void
Process
() {
40
old_read_ = read_;
41
read_ = analogRead(pin_);
42
}
39
void
Process
() {
…
}
43
49
inline
uint16_t
Read
() {
return
read_; }
50
51
private
:
52
uint8_t pin_;
53
uint16_t read_;
54
uint16_t old_read_;
55
};
20
class
AnalogInput
{
…
};
56
57
}
// namespace modulove
58
59
#endif
modulove::AnalogInput
Definition
analog_input.h:20
modulove::AnalogInput::Process
void Process()
Read the value of the analog input.
Definition
analog_input.h:39
modulove::AnalogInput::Init
void Init(uint8_t pin)
Initializes a analog input object.
Definition
analog_input.h:30
modulove::AnalogInput::Read
uint16_t Read()
Get the current value of the analog input.
Definition
analog_input.h:49
Generated by
1.9.8