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
Fork of circle_war_ver_A_NUCLEO_ by
Diff: encoder.cpp
- Revision:
- 14:3403ce49a37a
- Parent:
- 9:92ddadd9e9a9
--- a/encoder.cpp Mon Apr 04 09:26:26 2016 +0000 +++ b/encoder.cpp Tue Apr 05 17:25:09 2016 +0000 @@ -1,49 +1,49 @@ #include "mbed.h" #include <pin_file.h> #include <encoder.h> -InterruptIn b(EC1_b);//前部 -InterruptIn a(EC1_a); +InterruptIn bb(EC1_b);//前部 +InterruptIn aa(EC1_a); InterruptIn d(EC2_b);//右部 InterruptIn c(EC2_a); InterruptIn e(EC3_a);//左部 InterruptIn f(EC3_b); int count_f=0,count_r=0,count_l=0; -int pa,pb,pC,pd,pe,pf; +int pA,pB,pC,pd,pe,pf; //int s=0; //interrupt -void risea() +void riseaa() { - pa=1; - if(pb==0) { + pA=1; + if(pB==0) { count_f++; } else { count_f--; } } -void falla() +void fallaa() { - pa=0; - if(pb==0) { + pA=0; + if(pB==0) { count_f--; } else { count_f++; } } -void riseb() +void risebb() { - pb=1; - if(pa==0) { + pB=1; + if(pA==0) { count_f--; } else { count_f++; } } -void fallb() +void fallbb() { - pb=0; - if(pa==0) { + pB=0; + if(pA==0) { count_f++; } else { count_f--; @@ -128,10 +128,10 @@ void encoder_setting(){ //interrupt - a.rise(&risea); - a.fall(&falla); - b.rise(&riseb); - b.fall(&fallb); + aa.rise(&risea); + aa.fall(&falla); + bb.rise(&riseb); + bb.fall(&fallb); c.rise(&risec); c.fall(&fallc); d.rise(&rised); @@ -141,5 +141,4 @@ f.rise(&risef); f.fall(&fallf); //s++; - } - + } \ No newline at end of file