v1.1

Dependencies:   mbed QEI

main.cpp

Committer:
pokpongc
Date:
2019-05-05
Revision:
1:8e3af9643155
Parent:
0:ef2ee7458c37
Child:
2:eb82f5cb5098

File content as of revision 1:8e3af9643155:

#include "mbed.h"
#include "QEI.h"

Serial pc(USBTX, USBRX);

QEI temp_dial(D11, D12, A1, 50, QEI::X4_ENCODING);
BusIn joy_bus{D3, D4, D5, D6};
BusIn button_bus{D7, D9};
DigitalIn a(D7),b(D9),c(D3),d(D4),e(D5),f(D6); //Dummy pin for pulling


void init_();

int main() {
    pc.baud(115200);
    long pulse = 0;
    init_();
    while(1){
        pulse = temp_dial.getPulses()/2;
        pc.printf("%d \t%d\n",joy_bus.read(), button_bus.read());
        
        
    }
}


void init_(){
    a.mode(PullDown);
    b.mode(PullDown);
    c.mode(PullDown);
    d.mode(PullDown);
    e.mode(PullDown);
    f.mode(PullDown);   
}