Dependencies:   QEI RemoteIR mbed

Fork of encoder by Micromouse 18

main.cpp

Committer:
Joshua_Cheung
Date:
2017-11-29
Revision:
8:6b2f7886768d
Parent:
7:e10dc3cb9212

File content as of revision 8:6b2f7886768d:

/*
#include "mbed.h"
Serial pc (PA_2, PA_3);
/*
#include "QEI.h"
Serial pc (PA_2, PA_3); //serial comm enabled on pins pa_2 and pa_3
QEI encoder_Right(PB_3, PA_15, NC, 360, QEI::X4_ENCODING);
QEI encoder_Left(PA_1, PC_4, NC, 360, QEI::X4_ENCODING);   //forward increases pulses
PwmOut m_Right_B(PC_7);
PwmOut m_Right_F(PB_10);
PwmOut m_Left_F(PA_7); 
PwmOut m_Left_B(PB_6); 
*/

/*//IRR = IR Reciver
AnalogIn RS_IRR(PA_0); //Right Side 
AnalogIn RF_IRR(PA_4); //Right Front
AnalogIn LF_IRR(PC_1); //Left Front
AnalogIn LS_IRR(PC_0); //Left Side

//IRE = IR Emitter
DigitalOut RS_IRE(PC_10); //Right Side
DigitalOut RF_IRE(PC_11); //Right Front
DigitalOut LF_IRE(PB_0); //Left Front
DigitalOut LS_IRE(PB_7); //Left Side 

//QEI functions
/*
void    reset (void)
    Reset the encoder.
int     getCurrentState (void)
    Read the state of the encoder.
int     getPulses (void)
    Read the number of pulses recorded by the encoder.
int     getRevolutions (void)
    Read the number of revolutions recorded by the encoder on the index channel.
*/

/*
int main()
{
    while(1)
    {
        LS_IRE.write(1);
        float value = LS_IRR.read();
        printf("IR Led: %f", value);
        wait(100);
        LS_IRE.write(0);    
    }
}
*/