หน้าแรก
สินค้าทั้งหมด
วิธีการสั่งซื้อสินค้า
แจ้งชำระเงิน
บทความ
เกี่ยวกับเรา
ติดต่อเรา
หน้าแรก
>
บทความ
>
การใช้งาน Ultrasonic HY-SRF05
การใช้งาน Ultrasonic HY-SRF05
5 ปีที่ผ่านมา
โดย
เจ้าของร้าน
1.ต่อวงจรตามรูป
2.
ใส่ Code ตามนี้และกด Upload
/*
* Ultrasonic Sensor HC-SR04 and Arduino Tutorial
*
* by Dejan Nedelkovski,
* www.HowToMechatronics.com
*
*/
// defines pins numbers
const
int trigPin
=
9
;
const
int echoPin
=
10
;
// defines variables
long duration
;
int distance
;
void
setup
(
)
{
pinMode
(
trigPin
,
OUTPUT
)
;
// Sets the trigPin as an Output
pinMode
(
echoPin
,
INPUT
)
;
// Sets the echoPin as an Input
Serial
.
begin
(
9600
)
;
// Starts the serial communication
}
void
loop
(
)
{
// Clears the trigPin
digitalWrite
(
trigPin
,
LOW
)
;
delayMicroseconds
(
2
)
;
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite
(
trigPin
,
HIGH
)
;
delayMicroseconds
(
10
)
;
digitalWrite
(
trigPin
,
LOW
)
;
// Reads the echoPin, returns the sound wave travel time in microseconds
duration
=
pulseIn
(
echoPin
,
HIGH
)
;
// Calculating the distance
distance
=
duration
*
0.034
/
2
;
// Prints the distance on the Serial Monitor
Serial
.
print
(
"Distance: "
)
;
Serial
.
println
(
distance
)
;
}
2.ดูตัวอย่างการใช้งานได้ที่เมนู Tools->Serial Monitor เป็นอันเสร็จเรียบร้อย
Add to Phrasebook
No word lists for Thai -> English...
Create a new word list...
Copy
Add to Phrasebook
No word lists for English -> English...
Create a new word list...
Copy
Add to Phrasebook
No word lists for English -> English...
Create a new word list...
Copy
Share
Share :
COPY
Copyright © 2025
www.buraphatronics.com
All rights reserved.
ตะกร้า
(
0
)
▲
▼
รายการสั่งซื้อของฉัน
เข้าสู่ระบบด้วย
เข้าสู่ระบบ
สมัครสมาชิก
ยังไม่มีบัญชีเทพ
สร้างบัญชีใหม่
ไม่มีค่าใช้จ่าย
สมัครสมาชิก (ฟรี)
รายการสั่งซื้อของฉัน
ข้อมูลร้านค้านี้
Buraphatronics
บูรพาทรอนิกส์ จำหน่ายบอร์ด Arduino , NodeMCU , RasberryPi , PLC อุปกรณ์ไฟฟ้าและอิเล็กทรอนิกส์ อีกมากมาย
เบอร์โทร :
0812379629
,
0824804741
อีเมล :
buraphatronics@gmail.com
ส่งข้อความติดต่อร้าน
เกี่ยวกับร้านค้านี้
ค้นหาสินค้าในร้านนี้
ค้นหา
หรือค้นหาอย่างละเอียด
ค้นหาสินค้า
สินค้าที่ดูล่าสุด
{{pdata.name}}
ดูสินค้าทั้งหมดในร้าน
สินค้าที่ดูล่าสุด
บันทึกเป็นร้านโปรด
Join เป็นสมาชิกร้าน
แชร์หน้านี้
แชร์หน้านี้
↑
TOP
เลื่อนขึ้นบนสุด
คุณมีสินค้า
0
ชิ้นในตะกร้า
สั่งซื้อทันที
สินค้าในตะกร้า ({{total_num}} รายการ)
ขออภัย ขณะนี้ยังไม่มีสินค้าในตะกร้า
ราคาสินค้าทั้งหมด
฿ {{price_format(total_price)}}
- ฿ {{price_format(discount.price)}}
ราคาสินค้าทั้งหมด
{{total_quantity}} ชิ้น
฿ {{price_format(after_product_price)}}
ราคาไม่รวมค่าจัดส่ง
ดูสินค้าในตะกร้า
เริ่มการสั่งซื้อ
➜
เลือกซื้อสินค้าเพิ่ม
พูดคุย-สอบถาม
อีเมล buraphatronics@gmail.com
โทร 0812379629 , 0824804741
BuraphaTronics Channel
pg/บูรพาทรอนิกส์-จำหน่ายบอร์ด-Arduino-Pi-PLC-691092421334418/shop/?rt=29
Add sasina_mind