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.
Dependents: ESP8266_pid_mtrPos_webserver_SDcard_v2 ESP8266_pid_mtrSpeed_Webserver_SDcard ESP8266_pid_spd_and_pos_webserver_SDcard pid_encoder_speed_demo ... more
QEI.cpp
00001 #include "QEI.h" 00002 00003 QEI::QEI(PinName encA, PinName encB): _encA(encA), _encB(encB){ 00004 _encA.mode(PullUp); 00005 _encA.rise(this, &QEI::callback); 00006 00007 _encB.mode(PullUp); 00008 } 00009 00010 long QEI::read(){ 00011 return count; 00012 } 00013 00014 void QEI::reset(){ 00015 count = 0; 00016 } 00017 00018 void QEI::callback(){ 00019 if(_encB) count--; // CCW count 00020 else count++; // CW count 00021 }
Generated on Sat Jul 23 2022 03:52:54 by
1.7.2