DCCpp
This is the library version of a program for Arduino to control railroading DCC devices.
CurrentMonitor.h
1 /**********************************************************************
2 
3 CurrentMonitor.h
4 COPYRIGHT (c) 2013-2016 Gregg E. Berman
5 
6 Part of DCC++ BASE STATION for the Arduino
7 
8 **********************************************************************/
9 
10 #ifdef ARDUINO_ARCH_AVR
11 #ifndef CurrentMonitor_h
12 #define CurrentMonitor_h
13 
15 #define CURRENT_SAMPLE_SMOOTHING 0.01
16 
20 #if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_NANO) // Configuration for UNO
21  #define CURRENT_SAMPLE_TIME 10
22 #else // Configuration for MEGA
23  #define CURRENT_SAMPLE_TIME 1
24 #endif
25 
28 struct CurrentMonitor{
29  static long int sampleTime;
30  int pin;
31  int signalPin;
32  float currentSampleMax;
33  float current;
34  const char *msg;
41  void begin(int pin, int inSignalPin, const char *msg, float inSampleMax = 300);
44  static boolean checkTime();
47  void check();
48 };
49 
50 #endif
51 #endif