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.
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;
}
}