mirror of
https://gitlab.com/Luci_/arduino-photometrics.git
synced 2026-04-03 11:35:37 +02:00
27 lines
649 B
C++
Executable file
27 lines
649 B
C++
Executable file
#ifndef PHOTORESISANCE_OHM_RETRIEVAL_H
|
|
#define PHOTORESISANCE_OHM_RETRIEVAL_H
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
|
const float mega2560_max_current = 50e-3; // 50 mA
|
|
const float mega2560_max_vcc = 5.5;
|
|
const int32_t r_voltage_divider = 330e3;
|
|
|
|
// SensorOhm calculate the value of the photoresistor with the voltage divider circuits
|
|
class SensorOhm {
|
|
public:
|
|
SensorOhm(uint8_t pin_analog_read = A0, float vcc = mega2560_max_vcc, int32_t rFixed = r_voltage_divider, float current = mega2560_max_current);
|
|
|
|
void setup();
|
|
int32_t readResistance();
|
|
|
|
private:
|
|
|
|
uint8_t pin_analog_read;
|
|
float vcc;
|
|
int32_t rFixed;
|
|
float current;
|
|
};
|
|
|
|
#endif |