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.
Motor.h
00001 #ifndef Motor_H 00002 #define Motor_H 00003 #include "mbed.h" 00004 /* ************************************************************************** 00005 00006 @CCastrop 00007 cristiank.castrop@ecci.edu.co 00008 00009 00010 datasheet https://www.mouser.com/catalog/specsheets/TCS3200-E11.pdf 00011 00012 00013 S0 Frequency scaling 00014 S1 Frequency scaling 00015 S2 Photo diode selection 00016 S3 Photo diode selection 00017 OutFreq Frequency 00018 00019 ----------------------------------- 00020 | ____________ ____________ | 00021 ----> | | | | | | ___ ___ 00022 Light | | Photodiode | | Current |--|---OUTPUT_FREQ | |___| |___ 00023 ----> | | Array |---| to | | 00024 | | | | Frequency | | 00025 | |____________| |____________| | 00026 | ^ ^ ^ ^ | 00027 -------|--|-------------|--|------- 00028 | | | | 00029 S2 S3 S0 S1 00030 00031 SO | S1 | OUTPUT FREQUENCY SCALING | | S2 | S3 | PHOTODIODE TYPE | 00032 0 | 0 | power down | | 0 | 0 | Red | 00033 0 | 1 | 2% | | 0 | 1 | Blue | 00034 1 | 0 | 20% | | 1 | 0 | Clear (no filter) | 00035 1 | 1 | 100% | | 1 | 1 | Green | 00036 00037 ******************************************************************************/ 00038 00039 00040 00041 class MotorContinuo { 00042 public: 00043 00044 MotorContinuo(PinName L1, PinName L2, PinName speedPin); // declaracion del Objeto 00045 00046 void Forward(); // Da un sentido de giro al motor 00047 void Back(); // Genera un sentido de giro contrario al de Forward 00048 void Stop(); // Detiene el motor dejando el movimiento libre 00049 void StopT(); // Detiene el motor truncando o enclavando el movimiento(Lo mantiene quieto). 00050 void SpeedDuty(int v); // Varia la velocidad de giro del motor de 0 a 100% 00051 void SpinLength_ms(float t); // Duración del giro en ms 00052 void SpinLength(float t); // Duración del giro 00053 00054 float GetSpeed(); // Return Duty Cycle of PWM in % de 0 a 100 00055 00056 private: 00057 DigitalOut _L1; 00058 DigitalOut _L2; 00059 PwmOut _speedPin; 00060 00061 00062 }; 00063 #endif 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078
Generated on Sun Aug 21 2022 21:53:28 by
1.7.2