Massimo Viaro / Mbed 2 deprecated Viaro_SpandiConcime_V2b

Dependencies:   mbed

Fork of Viaro_SpandiConcime_V2b by Neri Tiziano

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers variables.h Source File

variables.h

00001 int SD_faultA=0;
00002 int SD_faultB=0;
00003 int DC_brake=1;
00004 int DC_forward=1;
00005 
00006 string MachineType("electric");  //two options: "electric" or "idraulic"
00007 
00008 float Percent(1.0);  //variable to add/take out a Percent of product with PlusPercentPin/MinusPercentPin
00009 char ChangeFromOffToOn(1);  //used to reset Previous millis() when the operator switch off and back on
00010 char StopTheMotorWeGoTooSlow(1);  //stop the motor, we go too slow
00011 char MotorSensorError(1);  //stop the motor, we go too slow
00012 int TrigsPerWheelRevolution(10);  //number of triggers per weheel complete revolution
00013 int WheelDiameter(400);  //wheel diameter in millimeters
00014 unsigned long WantedMotorSpeed(0);  //motor speed (initial is 0)
00015 unsigned long ReadMotorSpeed(0);  //motor speed (initial is 0)
00016 float MotorSpeedCorrected(0);  //motor speed (initial is 0)
00017 float MotorSpeedPwmTemp(0);  //motor speed pwm (initial is 0)
00018 float MotorSpeedPwm(0);  //motor speed pwm (initial is 0)
00019 int MinMotorPwm(1);  //min pwm for the motor to start
00020 int MinMotorSpeed(10);  //min motor speed
00021 int MaxMotorSpeed(100000);  //max motor speed
00022 float WheelToMotorRatio;  //set the ideal ratio between wheel speed and motor speed
00023 //float ReductionRatio(24);
00024 float MotorCorrection(1.0);  //set the initial motor correction factor
00025 int MotorSensorSecurityCheck(0);  //set the initial motor correction factor
00026 float DecelerationControlRatio(1.5);  //ratio to control wheel decelaration accepted limit
00027 const int ConstArrayIns(3);  //the number set the array values
00028 CB1<int,ConstArrayIns> ReadWheelArray;  //Circular array (for LIFO purposes) for wheel sensor readings
00029 CB1<int,ConstArrayIns> ReadMotorArray;  //Circular array (for LIFO purposes) for wheel sensor readings
00030 int i;  //general purpose integer for loops
00031 int a;  //general purpose integer for loops
00032 unsigned long TempRead;  //temporal read of wheel sensor millis for analysis
00033 unsigned long TempReadM;  //temporal read of motor sensor millis for analysis
00034 unsigned long Elapsed(0);  //used to take note of Elapsed time
00035 unsigned long ElapsedM(0);  //used to take note of Elapsed time
00036 unsigned long CheckIfReadMChanges(0);  //feedback of motor sensor
00037 //from PID library: 0.0 - 1.0
00038 PID motorPID(1.0, 0.2, 0.4, 0.1);  //Kc, Ti, Td, interval (0.1ms)
00039 
00040 //the below declarations are meant to prevent problems on switches due to tractor vibrations
00041 int VibrationTimer(500);  //timer for avoid vibrations in millis
00042 char ChangeStatusOfOnOffPinToHigh(1);
00043 char ChangeStatusOfOnOffPinToLow(1);
00044 unsigned long OnOffPinTimerToHigh(0);  //this is to avoid false positive on ON/OFF switch due to vibrations
00045 unsigned long OnOffPinTimerToLow(0);  //this is to avoid false positive on ON/OFF switch due to vibrations
00046 char ChangeStatusOfPlusPercentPinToHigh(1);
00047 char ChangeStatusOfPlusPercentPinToLow(1);
00048 unsigned long PlusPercentPinTimerToHigh(0);  //this is to avoid false positive on Plus switch due to vibrations
00049 unsigned long PlusPercentPinTimerToLow(0);  //this is to avoid false positive on Plus switch due to vibrations
00050 char PercentPlus(0);
00051 char ChangeStatusOfMinusPercentPinToHigh(1);
00052 char ChangeStatusOfMinusPercentPinToLow(1);
00053 unsigned long MinusPercentPinTimerToHigh(0);  //this is to avoid false positive on Minus switch due to vibrations
00054 unsigned long MinusPercentPinTimerToLow(0);  //this is to avoid false positive on Minus switch due to vibrations
00055 char PercentMinus(0);