<?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>Arduino: Find the greatest value</title><link>/products/arduino/b/blog/posts/arduino-find-the-greatest-value</link><description>Dear element14 members, I am doing a science fair project where I am taking 10 readings from a photo-resistor and trying to take the greatest value to do something else. Is there a simpler code than making a lot of ...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Arduino: Find the greatest value</title><link>https://community.element14.com/products/arduino/b/blog/posts/arduino-find-the-greatest-value</link><pubDate>Tue, 11 Feb 2014 03:40:39 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:09dd97bc-958b-4000-bf80-36b37d9490b2</guid><dc:creator>Former Member</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Here is what I am doing. I have a photo resistor on a servo. Every 5 minutes I want the servo to move to 10 different positions and take 10 readings. Then I want it to take the greatest of the readings and move a different servo to the positions of the greatest reading.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks in advance,&lt;/p&gt;&lt;p&gt;Nehemiah Branson&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=17177&amp;AppID=145&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Arduino: Find the greatest value</title><link>https://community.element14.com/products/arduino/b/blog/posts/arduino-find-the-greatest-value</link><pubDate>Mon, 10 Feb 2014 19:48:38 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:09dd97bc-958b-4000-bf80-36b37d9490b2</guid><dc:creator>dougw</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;span&gt;Hi Nehemiah,&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;For a software solution you could use a &amp;quot;For&amp;quot; loop.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Cycle through all 10 readings - if the next reading is greater than the max reading, replace the max reading with this new value.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Doug&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=17177&amp;AppID=145&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Arduino: Find the greatest value</title><link>https://community.element14.com/products/arduino/b/blog/posts/arduino-find-the-greatest-value</link><pubDate>Mon, 10 Feb 2014 19:33:13 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:09dd97bc-958b-4000-bf80-36b37d9490b2</guid><dc:creator>dougw</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Hi Nehemiah,&lt;/p&gt;&lt;p&gt;What is the timing of your 10 readings?&lt;/p&gt;&lt;p&gt;You might be able to use a &amp;quot;peak-hold&amp;quot; circuit to retain the maximum analog voltage and just sample it once.&lt;/p&gt;&lt;p&gt;There are lots of example circuits on the net - the simplest uses just a diode and capacitor and maybe a resistor.&lt;/p&gt;&lt;p&gt;For higher accuracy you can add a dual op-amp to eliminate the voltage drop across the diode.&lt;/p&gt;&lt;p&gt;If you describe the requirement in more detail, the optimal solution description can also be more detailed.&lt;/p&gt;&lt;p&gt;Doug&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=17177&amp;AppID=145&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>