natsu tsumagari
/
test_cadenceClass
回転数計のクラスです。
main.cpp@1:6bceac3446ff, 2016-11-23 (annotated)
- Committer:
- tsumagari
- Date:
- Wed Nov 23 05:31:01 2016 +0000
- Revision:
- 1:6bceac3446ff
- Parent:
- 0:57308daf8dfe
- Child:
- 2:b492f029a2f4
ho
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tsumagari | 0:57308daf8dfe | 1 | #include "mbed.h" |
tsumagari | 1:6bceac3446ff | 2 | #include "Cadence.h" |
tsumagari | 1:6bceac3446ff | 3 | //#include <string> |
tsumagari | 0:57308daf8dfe | 4 | |
tsumagari | 0:57308daf8dfe | 5 | DigitalOut myled(LED1); |
tsumagari | 0:57308daf8dfe | 6 | Ticker cadenceTicker; |
tsumagari | 0:57308daf8dfe | 7 | Serial pc(USBTX,USBRX); //for debug |
tsumagari | 0:57308daf8dfe | 8 | |
tsumagari | 0:57308daf8dfe | 9 | Cadence cadence(p13,p14); |
tsumagari | 0:57308daf8dfe | 10 | |
tsumagari | 0:57308daf8dfe | 11 | int main() { |
tsumagari | 0:57308daf8dfe | 12 | pc.baud(115200); |
tsumagari | 0:57308daf8dfe | 13 | while(1) { |
tsumagari | 0:57308daf8dfe | 14 | myled = 1; |
tsumagari | 0:57308daf8dfe | 15 | wait(0.2); |
tsumagari | 0:57308daf8dfe | 16 | myled = 0; |
tsumagari | 0:57308daf8dfe | 17 | wait(0.2); |
tsumagari | 0:57308daf8dfe | 18 | pc.printf("test\n\r"); |
tsumagari | 0:57308daf8dfe | 19 | pc.printf("cadence: %f\n\r",cadence.cadence); |
tsumagari | 0:57308daf8dfe | 20 | pc.printf("voltage: %f\n\r",cadence.cadenceV); |
tsumagari | 1:6bceac3446ff | 21 | pc.printf("'%c'\n\r",cadence.data[cadence.data_count-1]); |
tsumagari | 0:57308daf8dfe | 22 | cadence.cadenceRead(); |
tsumagari | 0:57308daf8dfe | 23 | } |
tsumagari | 0:57308daf8dfe | 24 | } |