DCCpp
This is the library version of a program for Arduino to control railroading DCC devices.
Sensor.h
1 /**********************************************************************
2 
3 Sensor.h
4 COPYRIGHT (c) 2013-2016 Gregg E. Berman
5 
6 Part of DCC++ BASE STATION for the Arduino
7 
8 **********************************************************************/
9 
10 #ifndef Sensor_h
11 #define Sensor_h
12 
13 #include "DCCpp.h"
14 
15 #ifdef USE_SENSOR
16 #include "Arduino.h"
17 
18 #define SENSOR_DECAY 0.03
19 
20 struct SensorData {
21  int snum;
22  byte pin;
23  byte pullUp;
24 };
25 
84 struct Sensor{
85  static Sensor *firstSensor;
86  SensorData data;
87  boolean active;
88  float signal;
89  Sensor *nextSensor;
90 
91  void begin(int snum, int pin, int pullUp);
92  void set(int snum, int pin, int pullUp);
93  static Sensor* get(int);
94  static void remove(int);
95  static int count();
96  static void check();
97  boolean isActive() { return this->active; }
98 
99 #ifdef DCCPP_PRINT_DCCPP
100  static void show();
101  static void status();
102 #endif
103 
104 #ifdef USE_EEPROM
105  static void load();
106  static void store();
107 #endif
108 
109 #if defined(USE_TEXTCOMMAND)
110  static void parse(char *c);
111  static Sensor *create(int snum, int pin, int pullUp);
112 #endif
113 }; // Sensor
114 
115 #endif
116 
117 #endif
Definition: Sensor.h:84