hanya buat kamu B

Dependencies:   QEI mbed

Committer:
gustavaditya
Date:
Sat Nov 05 09:56:54 2016 +0000
Revision:
0:bb49b8e23b5d
Child:
1:d4e4fc0ee666
buat kamu;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gustavaditya 0:bb49b8e23b5d 1 #include "mbed.h"
gustavaditya 0:bb49b8e23b5d 2 #include "QEI.h"
gustavaditya 0:bb49b8e23b5d 3
gustavaditya 0:bb49b8e23b5d 4 QEI encoder( PA_3, PA_2, NC, 360, QEI::X4_ENCODING);
gustavaditya 0:bb49b8e23b5d 5
gustavaditya 0:bb49b8e23b5d 6 Serial pc(USBTX,USBRX);
gustavaditya 0:bb49b8e23b5d 7
gustavaditya 0:bb49b8e23b5d 8 int pulse;
gustavaditya 0:bb49b8e23b5d 9 int rev;
gustavaditya 0:bb49b8e23b5d 10
gustavaditya 0:bb49b8e23b5d 11 int main()
gustavaditya 0:bb49b8e23b5d 12 {
gustavaditya 0:bb49b8e23b5d 13 pc.baud(115200);
gustavaditya 0:bb49b8e23b5d 14
gustavaditya 0:bb49b8e23b5d 15 while(1)
gustavaditya 0:bb49b8e23b5d 16 {
gustavaditya 0:bb49b8e23b5d 17 pulse = encoder.getPulses();
gustavaditya 0:bb49b8e23b5d 18 rev = encoder.getRevolutions();
gustavaditya 0:bb49b8e23b5d 19 pc.printf("%d Pulses\t\t%d Putaran\n", pulse, rev);
gustavaditya 0:bb49b8e23b5d 20 }
gustavaditya 0:bb49b8e23b5d 21 }