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.
Dependencies: mbed
Revision 2:95a9db056db1, committed 2019-11-22
- Comitter:
- YUPPY
- Date:
- Fri Nov 22 07:56:18 2019 +0000
- Parent:
- 1:d174c4427e69
- Commit message:
- matome;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Nov 15 12:42:26 2019 +0000
+++ b/main.cpp Fri Nov 22 07:56:18 2019 +0000
@@ -5,6 +5,7 @@
DigitalOut thermo(p20);
DigitalOut Ultra(p12);
Serial pc(USBTX,USBRX); // tx, rx
+void us015(void);
int main(){
float th;
@@ -16,12 +17,8 @@
Ultra=1;//超音波on
while(1) {
- hs.TrigerOut();
- wait(1);
- int distance;
- distance = hs.GetDistance();
- printf("%d\r\n",distance);//距離出力
-
+ int distance;
+ us015();
if(distance<2000){//超音波反応
Ultra=0;//超音波off
thermo=1;//焦電on
@@ -39,6 +36,14 @@
}
//while(true)
}
- return 0;
+
}
-
\ No newline at end of file
+ void us015(){
+ hs.TrigerOut();
+ wait(1);
+ int distance;
+ distance = hs.GetDistance();
+ printf("%d\r\n",distance);//距離出力
+ }
+
+
\ No newline at end of file