Sippakorn Saeng-aroon
/
InventorStudio_LCP2
v1.1
main.cpp@0:ef2ee7458c37, 2019-05-05 (annotated)
- Committer:
- pokpongc
- Date:
- Sun May 05 10:14:52 2019 +0000
- Revision:
- 0:ef2ee7458c37
- Child:
- 1:8e3af9643155
first commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pokpongc | 0:ef2ee7458c37 | 1 | #include "mbed.h" |
pokpongc | 0:ef2ee7458c37 | 2 | #include "QEI.h" |
pokpongc | 0:ef2ee7458c37 | 3 | |
pokpongc | 0:ef2ee7458c37 | 4 | Serial pc(USBTX, USBRX); |
pokpongc | 0:ef2ee7458c37 | 5 | |
pokpongc | 0:ef2ee7458c37 | 6 | QEI temp_dial(D11, D12, A1, 50, QEI::X4_ENCODING); |
pokpongc | 0:ef2ee7458c37 | 7 | BusIn joy_bus{D3, D4, D5, D6}; |
pokpongc | 0:ef2ee7458c37 | 8 | BusIn button_bus{D7, D9}; |
pokpongc | 0:ef2ee7458c37 | 9 | DigitalIn a(D7),b(D9),c(D3),d(D4),e(D5),f(D6); |
pokpongc | 0:ef2ee7458c37 | 10 | |
pokpongc | 0:ef2ee7458c37 | 11 | |
pokpongc | 0:ef2ee7458c37 | 12 | int main() { |
pokpongc | 0:ef2ee7458c37 | 13 | pc.baud(115200); |
pokpongc | 0:ef2ee7458c37 | 14 | long pulse = 0; |
pokpongc | 0:ef2ee7458c37 | 15 | a.mode(PullDown); |
pokpongc | 0:ef2ee7458c37 | 16 | b.mode(PullDown); |
pokpongc | 0:ef2ee7458c37 | 17 | c.mode(PullDown); |
pokpongc | 0:ef2ee7458c37 | 18 | d.mode(PullDown); |
pokpongc | 0:ef2ee7458c37 | 19 | e.mode(PullDown); |
pokpongc | 0:ef2ee7458c37 | 20 | f.mode(PullDown); |
pokpongc | 0:ef2ee7458c37 | 21 | while(1){ |
pokpongc | 0:ef2ee7458c37 | 22 | pulse = temp_dial.getPulses()/2; |
pokpongc | 0:ef2ee7458c37 | 23 | pc.printf("%d \t%d\n",joy_bus.read(), button_bus.read()); |
pokpongc | 0:ef2ee7458c37 | 24 | |
pokpongc | 0:ef2ee7458c37 | 25 | |
pokpongc | 0:ef2ee7458c37 | 26 | } |
pokpongc | 0:ef2ee7458c37 | 27 | } |
pokpongc | 0:ef2ee7458c37 | 28 |