{"id":2591,"date":"2023-04-06T15:27:30","date_gmt":"2023-04-06T13:27:30","guid":{"rendered":"https:\/\/www.heinpragt.nl\/?post_type=product&#038;p=2591"},"modified":"2026-02-12T14:26:05","modified_gmt":"2026-02-12T13:26:05","slug":"cny70","status":"publish","type":"product","link":"https:\/\/www.heinpragt.nl\/?product=cny70","title":{"rendered":"CNY70"},"content":{"rendered":"<p>CNY70 Reflective Optical Sensor with Transistor Output &#8211; often used for line follower robots to detect a surface or a black line.<\/p>\n<figure id=\"attachment_5191\" aria-describedby=\"caption-attachment-5191\" style=\"width: 545px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5191\" src=\"https:\/\/www.heinpragt.nl\/wp-content\/uploads\/2023\/04\/Naamloos-1.jpg\" alt=\"CNY70 Arduino\" width=\"545\" height=\"541\" srcset=\"https:\/\/www.heinpragt.nl\/wp-content\/uploads\/2023\/04\/Naamloos-1.jpg 545w, https:\/\/www.heinpragt.nl\/wp-content\/uploads\/2023\/04\/Naamloos-1-300x298.jpg 300w, https:\/\/www.heinpragt.nl\/wp-content\/uploads\/2023\/04\/Naamloos-1-150x150.jpg 150w, https:\/\/www.heinpragt.nl\/wp-content\/uploads\/2023\/04\/Naamloos-1-416x413.jpg 416w, https:\/\/www.heinpragt.nl\/wp-content\/uploads\/2023\/04\/Naamloos-1-100x100.jpg 100w\" sizes=\"auto, (max-width: 545px) 100vw, 545px\" \/><figcaption id=\"caption-attachment-5191\" class=\"wp-caption-text\">CNY70 Arduino<\/figcaption><\/figure>\n<h3>SOURCECODE<\/h3>\n<p>\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\/\/ CNY70ReadSerial<br \/>\n\/\/ Reads an analog input on pin 0, prints the result to the Serial Monitor.<br \/>\n\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>\/\/ the setup routine runs once when you press reset:<br \/>\nvoid setup()<br \/>\n{<br \/>\nSerial.begin(9600);<br \/>\n}<\/p>\n<p>void loop()<br \/>\n{<br \/>\nint sensorValue = analogRead(A0);<br \/>\nSerial.println(sensorValue);<br \/>\ndelay(100); \/\/ delay in between reads for stability<br \/>\n}<\/p>\n<p>Determine the minimum and maximum treshold values and use these in the code to determine if f.i. a black line is stil under the sensor.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CNY70 Reflective Optical Sensor with Transistor Output &#8211; often used for line follower robots to detect a surface or a black line. SOURCECODE \/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- \/\/ CNY70ReadSerial \/\/ Reads an analog input on pin 0, prints the result to the Serial Monitor. \/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- \/\/ the setup routine runs once when you press reset: void [&hellip;]<\/p>\n","protected":false},"featured_media":2592,"template":"","meta":[],"product_brand":[],"product_cat":[93],"product_tag":[],"class_list":["post-2591","product","type-product","status-publish","has-post-thumbnail","product_cat-sensors","first","instock","taxable","shipping-taxable","purchasable","product-type-simple"],"_links":{"self":[{"href":"https:\/\/www.heinpragt.nl\/index.php?rest_route=\/wp\/v2\/product\/2591","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.heinpragt.nl\/index.php?rest_route=\/wp\/v2\/product"}],"about":[{"href":"https:\/\/www.heinpragt.nl\/index.php?rest_route=\/wp\/v2\/types\/product"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.heinpragt.nl\/index.php?rest_route=\/wp\/v2\/media\/2592"}],"wp:attachment":[{"href":"https:\/\/www.heinpragt.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2591"}],"wp:term":[{"taxonomy":"product_brand","embeddable":true,"href":"https:\/\/www.heinpragt.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fproduct_brand&post=2591"},{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.heinpragt.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fproduct_cat&post=2591"},{"taxonomy":"product_tag","embeddable":true,"href":"https:\/\/www.heinpragt.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fproduct_tag&post=2591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}