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@0:ee90d231a709, 2020-03-02 (annotated)
- Committer:
- maxnagazumi
- Date:
- Mon Mar 02 10:54:23 2020 +0000
- Revision:
- 0:ee90d231a709
newone;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| maxnagazumi | 0:ee90d231a709 | 1 | #include "mbed.h" |
| maxnagazumi | 0:ee90d231a709 | 2 | #include"hcsr04.h" |
| maxnagazumi | 0:ee90d231a709 | 3 | |
| maxnagazumi | 0:ee90d231a709 | 4 | HCSR04 echo_1(PC_0,PC_12);//A |
| maxnagazumi | 0:ee90d231a709 | 5 | HCSR04 echo_2(PA_15,PB_7);//A |
| maxnagazumi | 0:ee90d231a709 | 6 | HCSR04 echo_3(PH_1,PB_0);// B |
| maxnagazumi | 0:ee90d231a709 | 7 | HCSR04 echo_4(PC_3,PB_10);//B |
| maxnagazumi | 0:ee90d231a709 | 8 | |
| maxnagazumi | 0:ee90d231a709 | 9 | int main() { |
| maxnagazumi | 0:ee90d231a709 | 10 | |
| maxnagazumi | 0:ee90d231a709 | 11 | printf("100"); |
| maxnagazumi | 0:ee90d231a709 | 12 | |
| maxnagazumi | 0:ee90d231a709 | 13 | double a=0,b=0,c=0,d=0; |
| maxnagazumi | 0:ee90d231a709 | 14 | while(1) { |
| maxnagazumi | 0:ee90d231a709 | 15 | echo_1.start(); |
| maxnagazumi | 0:ee90d231a709 | 16 | echo_2.start(); |
| maxnagazumi | 0:ee90d231a709 | 17 | echo_3.start(); |
| maxnagazumi | 0:ee90d231a709 | 18 | echo_4.start(); |
| maxnagazumi | 0:ee90d231a709 | 19 | wait(1);//minimum wait is 30msec |
| maxnagazumi | 0:ee90d231a709 | 20 | a=echo_1.get_dist_cm(); |
| maxnagazumi | 0:ee90d231a709 | 21 | b=echo_2.get_dist_cm(); |
| maxnagazumi | 0:ee90d231a709 | 22 | c=echo_3.get_dist_cm(); |
| maxnagazumi | 0:ee90d231a709 | 23 | d=echo_4.get_dist_cm(); |
| maxnagazumi | 0:ee90d231a709 | 24 | printf("a:%lf b:%lf c:%lf d:%lf\r\n",a,b,c,d); |
| maxnagazumi | 0:ee90d231a709 | 25 | } |
| maxnagazumi | 0:ee90d231a709 | 26 | } |
| maxnagazumi | 0:ee90d231a709 | 27 | |
| maxnagazumi | 0:ee90d231a709 | 28 |