Francesco Pistone
/
Viaro_SpandiConcime_V3_inizio
copia12092018
variables.h
- Committer:
- viaromassimo
- Date:
- 2018-06-19
- Revision:
- 3:1cd8d048cd4a
- Parent:
- 0:b0a79a3a9da8
- Child:
- 4:1643fea75703
File content as of revision 3:1cd8d048cd4a:
int SD_faultA=0; int SD_faultB=0; int DC_brake=1; int DC_forward=1; string MachineType("electric"); //two options: "electric" or "idraulic" float Percent(1.0); //variable to add/take out a Percent of product with PlusPercentPin/MinusPercentPin char ChangeFromOffToOn(1); //used to reset Previous millis() when the operator switch off and back on char StopTheMotorWeGoTooSlow(1); //stop the motor, we go too slow char MotorSensorError(1); //stop the motor, we go too slow int TrigsPerWheelRevolution(10); //number of triggers per weheel complete revolution int WheelDiameter(400); //wheel diameter in millimeters unsigned long WantedMotorSpeed(0); //motor speed (initial is 0) unsigned long ReadMotorSpeed(0); //motor speed (initial is 0) float MotorSpeedCorrected(0); //motor speed (initial is 0) float MotorSpeedPwmTemp(0); //motor speed pwm (initial is 0) float MotorSpeedPwm(0); //motor speed pwm (initial is 0) int MinMotorPwm(1); //min pwm for the motor to start int MinMotorSpeed(1300); //min motor speed int MaxMotorSpeed(100000); //max motor speed float WheelToMotorRatio; //set the ideal ratio between wheel speed and motor speed //float ReductionRatio(24); float MotorCorrection(1.0); //set the initial motor correction factor int MotorSensorSecurityCheck(0); //set the initial motor correction factor float DecelerationControlRatio(1.5); //ratio to control wheel decelaration accepted limit const int ConstArrayIns(4); //the number set the array values CB1<int,ConstArrayIns> ReadWheelArray; //Circular array (for LIFO purposes) for wheel sensor readings CB1<int,ConstArrayIns> ReadMotorArray; //Circular array (for LIFO purposes) for wheel sensor readings int i; //general purpose integer for loops int a; //general purpose integer for loops unsigned long TempRead; //temporal read of wheel sensor millis for analysis unsigned long TempReadM; //temporal read of motor sensor millis for analysis unsigned long Elapsed(0); //used to take note of Elapsed time unsigned long ElapsedM(0); //used to take note of Elapsed time unsigned long CheckIfReadMChanges(0); //feedback of motor sensor //from PID library: 0.0 - 1.0 PID motorPID(1.0, 0.4, 0.3, 0.3); //Kc, Ti, Td, interval (0.1ms) //the below declarations are meant to prevent problems on switches due to tractor vibrations int VibrationTimer(500); //timer for avoid vibrations in millis char ChangeStatusOfOnOffPinToHigh(1); char ChangeStatusOfOnOffPinToLow(1); unsigned long OnOffPinTimerToHigh(0); //this is to avoid false positive on ON/OFF switch due to vibrations unsigned long OnOffPinTimerToLow(0); //this is to avoid false positive on ON/OFF switch due to vibrations char ChangeStatusOfPlusPercentPinToHigh(1); char ChangeStatusOfPlusPercentPinToLow(1); unsigned long PlusPercentPinTimerToHigh(0); //this is to avoid false positive on Plus switch due to vibrations unsigned long PlusPercentPinTimerToLow(0); //this is to avoid false positive on Plus switch due to vibrations char PercentPlus(0); char ChangeStatusOfMinusPercentPinToHigh(1); char ChangeStatusOfMinusPercentPinToLow(1); unsigned long MinusPercentPinTimerToHigh(0); //this is to avoid false positive on Minus switch due to vibrations unsigned long MinusPercentPinTimerToLow(0); //this is to avoid false positive on Minus switch due to vibrations char PercentMinus(0);