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: mbed
main.cpp
- Committer:
- NYANTA
- Date:
- 2018-08-16
- Revision:
- 1:6b53b598b5f5
- Parent:
- 0:7f7fff9d3383
File content as of revision 1:6b53b598b5f5:
#include "mbed.h" #include "QEI.h" Serial pc(USBTX,USBRX); DigitalOut GLED(PB_7); DigitalOut YLED(PC_12); DigitalOut BLED(PD_2); DigitalOut R1LED(PC_13); DigitalOut R2LED(PA_4); DigitalOut R3LED(PB_0); DigitalOut R4LED(PC_2); DigitalOut R5LED(PC_3); DigitalIn UBTN1(PA_0); DigitalIn UBTN2(PA_1); DigitalIn FOTO1(PA_15); DigitalIn FOTO2(PC_5); QEI ECR(PA_2,PA_3,NC,600,QEI::X4_ENCODING); int main(void){ GLED = 1; while(true){ /*GLED = 1; YLED = 1; BLED = 1; R1LED = 1; R2LED = 1; R3LED = 1; R4LED = 1; R5LED = 1; wait(0.5); GLED = 1; YLED = 1; BLED = 1; R1LED = 1; R2LED = 1; R3LED = 1; R4LED = 1; R5LED = 1;*/ wait(0.5); pc.printf("Pulses: %07d\n", ECR.getPulses()/4); pc.printf("Rotate: %04.3f\033[0J\033[H", (double)ECR.getPulses()/(600*4)); } }