Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@1:82989f872e3b, 2016-06-16 (annotated)
- Committer:
- ohtsuka
- Date:
- Thu Jun 16 01:34:22 2016 +0000
- Revision:
- 1:82989f872e3b
- Parent:
- 0:6faa2b0370ff
- Child:
- 2:918e95bf0abc
change serial bauldrate 9600 to 115200 for debug printing.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ohtsuka | 0:6faa2b0370ff | 1 | #include "mbed.h" |
| ohtsuka | 0:6faa2b0370ff | 2 | #include "MultiClick.h" |
| ohtsuka | 0:6faa2b0370ff | 3 | |
| ohtsuka | 1:82989f872e3b | 4 | Serial pc(USBTX,USBRX); |
| ohtsuka | 1:82989f872e3b | 5 | |
| ohtsuka | 0:6faa2b0370ff | 6 | DigitalOut myled(LED1); |
| ohtsuka | 0:6faa2b0370ff | 7 | |
| ohtsuka | 0:6faa2b0370ff | 8 | MultiClick btn(dp24, PullUp); |
| ohtsuka | 0:6faa2b0370ff | 9 | |
| ohtsuka | 0:6faa2b0370ff | 10 | void clicked(void){ |
| ohtsuka | 1:82989f872e3b | 11 | printf("\n********** single clicked.\n"); |
| ohtsuka | 0:6faa2b0370ff | 12 | } |
| ohtsuka | 0:6faa2b0370ff | 13 | |
| ohtsuka | 0:6faa2b0370ff | 14 | void d_clicked(void){ |
| ohtsuka | 1:82989f872e3b | 15 | printf("\n********** double clicked.\n"); |
| ohtsuka | 0:6faa2b0370ff | 16 | } |
| ohtsuka | 0:6faa2b0370ff | 17 | |
| ohtsuka | 0:6faa2b0370ff | 18 | void n_clicked(int times){ |
| ohtsuka | 1:82989f872e3b | 19 | printf("\n********** %d clicked.\n", times); |
| ohtsuka | 1:82989f872e3b | 20 | } |
| ohtsuka | 1:82989f872e3b | 21 | |
| ohtsuka | 1:82989f872e3b | 22 | void longpressed(void){ |
| ohtsuka | 1:82989f872e3b | 23 | printf("\n********** longpressed.\n"); |
| ohtsuka | 0:6faa2b0370ff | 24 | } |
| ohtsuka | 0:6faa2b0370ff | 25 | |
| ohtsuka | 0:6faa2b0370ff | 26 | int main() { |
| ohtsuka | 1:82989f872e3b | 27 | pc.baud(115200); |
| ohtsuka | 1:82989f872e3b | 28 | |
| ohtsuka | 0:6faa2b0370ff | 29 | btn.attach_clicked(clicked); |
| ohtsuka | 0:6faa2b0370ff | 30 | btn.attach_doubleclicked(d_clicked); |
| ohtsuka | 0:6faa2b0370ff | 31 | btn.attach_n_clicked(n_clicked); |
| ohtsuka | 1:82989f872e3b | 32 | btn.attach_longpressed(longpressed); |
| ohtsuka | 0:6faa2b0370ff | 33 | |
| ohtsuka | 0:6faa2b0370ff | 34 | while(1) { |
| ohtsuka | 0:6faa2b0370ff | 35 | myled = 1; |
| ohtsuka | 0:6faa2b0370ff | 36 | wait(0.2); |
| ohtsuka | 0:6faa2b0370ff | 37 | myled = 0; |
| ohtsuka | 0:6faa2b0370ff | 38 | wait(0.2); |
| ohtsuka | 0:6faa2b0370ff | 39 | } |
| ohtsuka | 0:6faa2b0370ff | 40 | } |