Ultrasonic transmitter emitted an ultrasonic wave in one direction, and started timing when it launched.
Pages / Page
6 /5 — 3 2. . HC. H S. C R. S 0. R 4. 0 li. l b. i r. b a. r r. a y. r fu. f n. …
File Format / Size
PDF / 740 Kb
Document Language
English
3 2. . HC. H S. C R. S 0. R 4. 0 li. l b. i r. b a. r r. a y. r fu. f n. u c. n t. c i. t o. i n. o de. d s. e c. s r. r p. i t. p i. L n. o g. n ti. t m. i i. m n. i g. n (. g ). f o. l a. o t
3.3 2. HCH SC RS 0R 40 lil bi rb ar ra yr fuf nu cn tc it oi no ded se cs rc ir pi tp it oi noLoL no gn tit mi im ni gn (g )( Function name: timing Parameters: None Return Value: the time of ultrasonic from the transmitter to the receiver flf ol ao ta CaC la cl Dc iD si ts at na cn ec (e l( ol no gn mim ci rc or so es ce ,c i, ni tn mem te rt ir ci )c Function name:CalcDistance � microsec: the time of ultrasonic from the transmitter to the receiver � metric: Set the unit of the return value ( the value of 1 for cm, and the value of 0 for in ) Return Value: the measured distance 3.3 3. AdA dd tht eh HCH -C S- RS 0R 40 LiL bi rb ar ra yr Step1:Download the Demo Code of HCSR04 Ultrasonic from address http://www.elecfreaks.com/store/download/product/Sensor/HC-SR04/HCSR04Ultrasonic_demo.zip and then unpack it to get the file of HCSR04 Ultrasonic. Step2: Add the file of HCSR04 Ultrasonic in the file of Arduino-1.0.X / libraries. Step3:If you can see the Example of HCSR04 Ultrasonic in Arduino IDE, the adding of HC-SR04 library has been successful. 3.3 4. TeT se ts tht eh MoM do ud lu el wiw ti ht tht eh ExE ax ma pm lp el se ofo LiL bi rb ar ra yr FiF li el 1. Open Arduino IDE 1.0.X, and choose the corresponding board and serial port. 2. Click file/ examples/ HCSR04Ultrasonic until the code pop up. 3. Compiling sketch until Done uploading appears, which represents the uploading has been successful. 4. Open serial monitor and set the corresponding BaudRate. 5. If you see similar information in serial monitor as below, you succeeded. 5 Document Outline HC-SR04UserGuide Part1UltrasonicIntroduction 1.1UltrasonicDefinition Thehumanearcanhearsoundfrequencyaround20HZ 1.2Ultrasonicdistancemeasurementprinciple Ultrasonictransmitteremittedanultrasonicwave 1.3UltrasonicApplication Part2HC-SR04UltrasonicModuleIntroduction 2.1ProductFeatures 2.2ProductImage 2.3、Modulepindefinitions 2.4、Electricalparameters 2.5ModuleoperatingPrinciple Part3UseFreaduinoUNOtotestHC-SR04 3.1FreaduinounoandHC-SR04Connection 3.2HCSR04libraryfunctiondescription Longtiming() floatCalcDistance(longmicrosec,intmetric) 3.3AddtheHC-SR04Library 3.4TesttheModulewiththeExamplesofLibraryF