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  float currentSampleMax;
32  float current;
33  const char *msg;
39  void begin(int pin, const char *msg, float inSampleMax = 300);
42  static boolean checkTime();
45  void check();
46 };
47 
48 #endif
49 #endif