Francesco Pistone
/
Viaro_SpandiConcime_V3_inizio
copia12092018
Diff: main.cpp
- Revision:
- 7:dc3cb1a5764b
- Parent:
- 5:72bdc69d610d
- Child:
- 8:b01d4cb1857f
--- a/main.cpp Wed Sep 12 14:41:23 2018 +0000 +++ b/main.cpp Fri Sep 14 09:31:34 2018 +0000 @@ -237,7 +237,9 @@ if(ElapsedM==0){ ReadMotorSpeed=0; }else{ + //francesco 14/09/2018 -->> il rapporto di riduzione è già stato considerato ReadMotorSpeed=float(60000000/(ElapsedM*4.0f)); // rev/min + //ReadMotorSpeed=float(60000000/ElapsedM); // rev/min } } @@ -275,7 +277,9 @@ wait(1); uSMotor.start(); uSWheel.start(); - MotorPwmPin.period_us(2000); // freq 1khz + //MotorPwmPin.period_us(2000); // freq 1khz + //francesco 13/09/2018 -->> periodo sbagliato se si vuole una frequenza di un khz + MotorPwmPin.period_us(1000); MotorPwmPin.write(0.0f); // duty cycle=off OffTheMotor(); MSToMotorNewCheck.attach(&CheckMotorCorrection, 0.1); //check motor correction every xx seconds @@ -287,10 +291,14 @@ WheelSensorPin.rise(&ReadWheelInterrupt); //interrupt for wheel sensor, trigs when changes from 0 to 1 MotorSensorPin.rise(&ReadMotorInterrupt); //interrupt for motor sensor, trigs when changes from 0 to 1 + //francesco 14/09/2018 -->> alzo il limite + //motorPID.setInputLimits(0, 1000000); -->> il test non ha buoni frutti, rimetto l'originale 10000 motorPID.setInputLimits(0, 10000); //70*secondosinaminute*trigsperwheelrevolutions + motorPID.setOutputLimits(0.0f, 1.0f); motorPID.setMode(1); - motorPID.setSetPoint(1000); + //francesco 14/09/2018 -->> non capisco perchè fornire un set point fisso + //motorPID.setSetPoint(1000); //*************************************************** //***************************************************