Sensor library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Sensor.h Source File

Sensor.h

00001 #ifndef SENSOR_H
00002 #define SENSOR_H
00003 #include "mbed.h"
00004 /* 
00005     Noam Nahum and Dror Balbul 05/10/2020
00006      Sensor reading and filtering for formula student vehicle
00007     The library takes 2 diffrential sensor and calculate to the diffrence between them.
00008     this library is for the FSAE regulation For reading Pedal Sensors and Thorttle Sensors.
00009     
00010     
00011     
00012     Note: Sensor objects use given pointers, ie Sensor_1 
00013             Sensor_2, lastscope. When reading/ modifying
00014             these vars make sure we don't have possible read/write 
00015             conflicts if the interrupt fires. */
00016             
00017     
00018 class Sensor {
00019     public:
00020         Sensor(float* Sensor_1, float* Sensor_2, float* lastscope, float* bias, float weight);  // Sensor_1, (Analogin value of sensor 1)
00021         float Sensor_Value_1(); // Sensor_1 Value between 0-255
00022         float Sensor_Value_2(); // Sensor_1 Value between 0-255
00023         //int Get_Error();
00024         void ApplyFilter(float newscope);
00025         void ChangeWeight(float new_weight);
00026         int ErrorCheck();
00027         float Sensor_Sum();
00028         float Sensor_Sub();
00029         float Sensor_timer();
00030      
00031     private:
00032         Timer timer;
00033         int _Error;
00034         float* _Sensor_1;
00035         float* _Sensor_2;
00036         float _Sensor_Value_1;
00037         float _Sensor_Value_2;
00038         float Sensor_sum, Sensor_sub;
00039         float _weight;
00040         float* _lastscope;
00041         float* _bias;
00042         float _Sensor_1_max;
00043         float _Sensor_1_min;
00044         float _Sensor_2_max;
00045         float _Sensor_2_min;
00046         
00047 };
00048     
00049 
00050 #endif     
00051