<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Raspberry Pi Pico multicore demo using HC-SR04 ultrasonic ranger and a 4-digit 7-segment display</title><link>/challenges-projects/project14/7segmentdisplay/b/blog/posts/raspberry-pi-pico-multicore-demo-using-ultrasonic-ranger-and-4-digit-7-segment-display</link><description>Introduction
Inspired by the Pi Pico with 7-segment display blog, written by ntewinkel , I decided to give it a go as I had a 4-digit 7-segment display in box that had never been used before.
Little did I realise what&amp;#39;s involved to get ...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Raspberry Pi Pico multicore demo using HC-SR04 ultrasonic ranger and a 4-digit 7-segment display</title><link>https://community.element14.com/challenges-projects/project14/7segmentdisplay/b/blog/posts/raspberry-pi-pico-multicore-demo-using-ultrasonic-ranger-and-4-digit-7-segment-display</link><pubDate>Sun, 29 May 2022 14:59:10 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:d75b2ff2-d2dd-48ac-ace1-77850b276cd1</guid><dc:creator>robogary</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Nice here is some Ping code without using a specific library.&lt;/p&gt;
&lt;p&gt;PingTrigger=Pin(9,Pin.OUT)&lt;br /&gt;PingEcho=Pin(8,Pin.IN)&lt;/p&gt;
&lt;p&gt;def Ping():&lt;br /&gt; echotries=0&lt;br /&gt; PingTrigger.low()&lt;br /&gt; utime.sleep_us(2) # note sleep_us is for microsecs&lt;br /&gt; PingTrigger.high()&lt;br /&gt; utime.sleep_us(10)&lt;br /&gt; PingTrigger.low()&lt;br /&gt; while ((PingEcho.value() == 0) and (echotries&amp;lt;30)):&lt;br /&gt; EchoStartTime = utime.ticks_us()&lt;br /&gt; echotries=echotries+1&lt;br /&gt; # This check bails out of the loop on a problem with a long echo or failed echo, I havent been able to prove its needed.&lt;br /&gt; &lt;br /&gt; while PingEcho.value()==1:&lt;br /&gt; EchoHeard = utime.ticks_us()&lt;br /&gt; PingDeltaTime=EchoHeard-EchoStartTime&lt;br /&gt; PingDistance_cm =(PingDeltaTime*.0343)/2 # sound is 343.2 m/s .0343 cm/usec&lt;br /&gt; PingDistance_in=(PingDistance_cm)/2.54&lt;br /&gt; #print (&amp;quot;Measured distance is &amp;quot;,PingDistance_cm, &amp;quot;cm&amp;quot; )&lt;br /&gt; print (&amp;quot;Measured distance is &amp;quot;,PingDistance_in, &amp;quot;inches&amp;quot; )&lt;br /&gt; #print (&amp;quot;Echotries =&amp;quot;, echotries)&lt;br /&gt; return PingDistance_in&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=23672&amp;AppID=368&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>