Go to the documentation of this file.00001 #include <iostream>
00002
00003 #include <pigpio.h>
00004
00005 #include "rotary_encoder.hpp"
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 void callback(int way)
00025 {
00026 static int pos = 0;
00027
00028 pos += way;
00029
00030 std::cout << "pos=" << pos << std::endl;
00031 }
00032
00033 int main(int argc, char *argv[])
00034 {
00035 if (gpioInitialise() < 0) return 1;
00036
00037 re_decoder dec(7, 8, callback);
00038
00039 sleep(3000);
00040
00041 dec.re_cancel();
00042
00043 gpioTerminate();
00044 }
00045