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.
Dependencies: QEI RemoteIR mbed
Fork of encoder_v2 by
main.cpp
00001 /* 00002 #include "mbed.h" 00003 Serial pc (PA_2, PA_3); 00004 /* 00005 #include "QEI.h" 00006 Serial pc (PA_2, PA_3); //serial comm enabled on pins pa_2 and pa_3 00007 QEI encoder_Right(PB_3, PA_15, NC, 360, QEI::X4_ENCODING); 00008 QEI encoder_Left(PA_1, PC_4, NC, 360, QEI::X4_ENCODING); //forward increases pulses 00009 PwmOut m_Right_B(PC_7); 00010 PwmOut m_Right_F(PB_10); 00011 PwmOut m_Left_F(PA_7); 00012 PwmOut m_Left_B(PB_6); 00013 */ 00014 00015 //IRR = IR Reciver 00016 /*AnalogIn RS_IRR(PA_0); //Right Side 00017 AnalogIn RF_IRR(PA_4); //Right Front 00018 AnalogIn LF_IRR(PC_1); //Left Front 00019 AnalogIn LS_IRR(PC_0); //Left Side 00020 00021 //IRE = IR Emitter 00022 DigitalOut RS_IRE(PC_10); //Right Side 00023 DigitalOut RF_IRE(PC_11); //Right Front 00024 DigitalOut LF_IRE(PB_0); //Left Front 00025 DigitalOut LS_IRE(PB_7); //Left Side 00026 */ 00027 //QEI functions 00028 /* 00029 void reset (void) 00030 Reset the encoder. 00031 int getCurrentState (void) 00032 Read the state of the encoder. 00033 int getPulses (void) 00034 Read the number of pulses recorded by the encoder. 00035 int getRevolutions (void) 00036 Read the number of revolutions recorded by the encoder on the index channel. 00037 */ 00038 00039 /* 00040 int main() 00041 { 00042 while(1) 00043 { 00044 LS_IRE.write(1); 00045 float value = LS_IRR.read(); 00046 printf("IR Led: %f", value); 00047 wait(100); 00048 LS_IRE.write(0); 00049 } 00050 } 00051 */
Generated on Sun Jul 24 2022 15:45:27 by
1.7.2
