12 #include "DCCpp_Uno.h" 13 #include "CurrentMonitor.h" 29 if(millis( ) -
sampleTime < CURRENT_SAMPLE_TIME)
37 if (this->
pin == UNDEFINED_PIN || this->
signalPin == UNDEFINED_PIN)
40 #if defined(ARDUINO_ARCH_ESP32) 43 for (
int j = 0; j < 50; j++)
45 base += analogRead(this->
pin);
47 this->
current = (float) ((base / 50.0) * 0.9) - 100;
49 this->
current = (float)(analogRead(this->
pin) * CURRENT_SAMPLE_SMOOTHING + this->
current * (1.0 - CURRENT_SAMPLE_SMOOTHING));
56 DCCPP_INTERFACE.print(this->
msg);
57 #if !defined(USE_ETHERNET) 58 DCCPP_INTERFACE.println(
"");
static boolean checkTime()
static long int sampleTime
void begin(int pin, int inSignalPin, const char *msg, float inSampleMax=300)