Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: JetflyerMotorController
Brake.h
00001 #include "mbed.h" 00002 #include "Controller.h" 00003 00004 #ifndef BRAKE_H 00005 #define BRAKE_H 00006 00007 #define PIN_BUTTON_BRAKE p22 //or whatever 00008 #define PIN_PWM_BRAKE p21 //or whatever 00009 #define PIN_DIR_BRAKE p23 //or whatever 00010 00011 #define CALIBRATION_FACTOR 200 // Steps per Rotation 00012 00013 #define MAX_SPEED_BRAKE 3 // 3 rotations per second 00014 #define MAX_ROTATIONS_FOR_BRAKEING 10.0 //still needs to 00015 #define HYSTERESIS 5 00016 00017 class Brake 00018 { 00019 public: 00020 00021 Brake(); 00022 ~Brake(); 00023 00024 void calibrateServo(); 00025 bool getBrakeing(); 00026 void brake(int percantage, int speed); 00027 00028 private: 00029 00030 int drive_homeposition(void); 00031 int drive_brake(int _percentage, int _speed); 00032 bool _brakeing; 00033 DigitalIn _brakeButton; 00034 PwmOut _pwm; 00035 DigitalOut _dir; 00036 float _percantage; 00037 bool brake_switch; 00038 int ref_time; 00039 int cur_time; 00040 int percentage_old; 00041 int enable_drive; 00042 int calculated_position; 00043 int direction; 00044 int diff_time; 00045 int state_brakeButton_old; 00046 00047 00048 Timer t1; 00049 Timer t2; 00050 }; 00051 00052 #endif
Generated on Tue Jul 12 2022 22:55:19 by
1.7.2