{"id":1011,"date":"2018-09-23T01:57:07","date_gmt":"2018-09-23T01:57:07","guid":{"rendered":"https:\/\/zhutarduino.wordpress.com\/?page_id=1011"},"modified":"2019-03-30T21:55:54","modified_gmt":"2019-03-30T21:55:54","slug":"arduino-mad-scientist-laboratory-ep-1-ultrasonic-tripwire-alarm","status":"publish","type":"page","link":"https:\/\/thezhut.com\/?page_id=1011","title":{"rendered":"Arduino Mad Scientist Laboratory EP# 1 Ultrasonic Tripwire Alarm"},"content":{"rendered":"<p><iframe loading=\"lazy\" title=\"Arduino Mad Scientist Laboratory EP# 1 Ultrasonic Tripwire Alarm\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/yQkdRyG0dBA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<h1>SCHEMATIC:<\/h1>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/thezhut.com\/wp-content\/uploads\/2018\/08\/hc-sro4_schem.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-990\" src=\"https:\/\/thezhut.com\/wp-content\/uploads\/2018\/08\/hc-sro4_schem.jpg?w=300\" alt=\"\" width=\"638\" height=\"442\" srcset=\"https:\/\/thezhut.com\/wp-content\/uploads\/2018\/08\/hc-sro4_schem.jpg 1272w, https:\/\/thezhut.com\/wp-content\/uploads\/2018\/08\/hc-sro4_schem-300x208.jpg 300w, https:\/\/thezhut.com\/wp-content\/uploads\/2018\/08\/hc-sro4_schem-768x533.jpg 768w, https:\/\/thezhut.com\/wp-content\/uploads\/2018\/08\/hc-sro4_schem-1024x710.jpg 1024w\" sizes=\"auto, (max-width: 638px) 100vw, 638px\" \/><\/a><\/p>\n<h1>PARTS LIST:<\/h1>\n<p>ARDUINO NANO<\/p>\n<p>HC-SR04<\/p>\n<p>potentiometer<\/p>\n<p>tip120 Darlington transistor<\/p>\n<p>speaker<\/p>\n<p><span style=\"color: #000000; font-size: 2.4em;\">ARDUINO CODE:<\/span><\/p>\n<p>#define trigPin 9<br \/>\n#define echoPin 10<br \/>\nlong duration;<br \/>\nint distance;<br \/>\nint val;<\/p>\n<p>void setup()<br \/>\n{<\/p>\n<p>pinMode(trigPin, OUTPUT);<br \/>\npinMode(echoPin, INPUT);<\/p>\n<p>}<\/p>\n<p>void loop()<br \/>\n{<br \/>\nval = (analogRead(A1));<\/p>\n<p>digitalWrite(trigPin, LOW);<br \/>\ndelayMicroseconds(2);<br \/>\ndigitalWrite(trigPin, HIGH);<br \/>\ndelayMicroseconds(10);<br \/>\ndigitalWrite(trigPin, LOW);<br \/>\nduration = pulseIn(echoPin, HIGH);<br \/>\n\/\/distance = duration * 0.034 \/ 2; \/\/ cm<br \/>\ndistance = duration * 0.0133 \/ 2; \/\/ in<br \/>\nval = map(val, 0, 1023, 6, 36);<br \/>\nif (distance &lt;= val)<br \/>\n{<\/p>\n<p>tone(3, 500, 150);<br \/>\ndelay(150);<br \/>\ntone(3, 300, 150);<br \/>\ndelay(150);<\/p>\n<p>}<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SCHEMATIC: &nbsp; PARTS LIST: ARDUINO NANO HC-SR04 potentiometer tip120 Darlington transistor speaker ARDUINO CODE: #define trigPin 9 #define echoPin 10 long duration; int distance; int val; void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); } void loop() { val = (analogRead(A1)); &hellip; <a href=\"https:\/\/thezhut.com\/?page_id=1011\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":1009,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":"","_links_to":"","_links_to_target":""},"class_list":["post-1011","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/1011","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thezhut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1011"}],"version-history":[{"count":1,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/1011\/revisions"}],"predecessor-version":[{"id":1320,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/1011\/revisions\/1320"}],"up":[{"embeddable":true,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/1009"}],"wp:attachment":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}