ES305H Lanier Turchan / Mbed 2 deprecated Turret_Angle

Dependencies:   QEI mbed

Turret_Angle_encoder.cpp

Committer:
LanierUSNA16
Date:
2015-03-10
Revision:
0:60646c7af7a9
Child:
1:ec3cdf28c947

File content as of revision 0:60646c7af7a9:

#include "mbed.h"
#include "QEI.h"

QEI myEncoder (p15,p16, NC, 1600); 

int main ()
{
    int counter = 0;
    float time = 0.0; 
    float theta = 0.0; 
    float pulses = 0.0; 
    
    printf("The program is running\n"); 
    wait (2);
    
    while (counter<101)
    {
        wait(0.01); 
        pulses = myEncoder.getPulses(); 
        theta = pulses/ (1600*2.0*2*3.14);
        time = counter*0.01; 
        printf("Time(%d)= %f   \n", counter,time);
        printf("Angle(%d) = %f    \n", counter, theta);
        printf("pulses = %f \n", pulses); 
        counter= counter + 1; 
    }

}