<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; User Favorites: JR</title>
		<link><a href='http://forums.leaflabs.com/profile.php?id=3770'>3770</a></link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:19:49 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?profile=3770" rel="self" type="application/rss+xml" />

		<item>
			<title>gbulmer on "Using Modulus Division for Data Logging Delay"</title>
			<link>http://forums.leaflabs.com/topic.php?id=881#post-5422</link>
			<pubDate>Sun, 26 Jun 2011 18:06:42 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">5422@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Two things:&#60;br /&#62;
1. I would expect (dt % 1000 / 20) to produce:&#60;br /&#62;
0 to 19 = 0&#60;br /&#62;
20 to 999  &#38;gt; 0&#60;br /&#62;
If I have understood what your aiming for, I believe the definition for logInt should be:&#60;br /&#62;
# define logInt         (1000/sensorRate)&#60;br /&#62;
and not&#60;br /&#62;
# define logInt         1000/sensorRate&#60;/p&#62;
&#60;p&#62;2. The code:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;while (millis() % logInt)
      ;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;seems simpler.&#60;/p&#62;
&#60;p&#62;(full disclosure: I am not a member of LeafLabs staff)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>JR on "Using Modulus Division for Data Logging Delay"</title>
			<link>http://forums.leaflabs.com/topic.php?id=881#post-5421</link>
			<pubDate>Sun, 26 Jun 2011 17:39:47 +0000</pubDate>
			<dc:creator>JR</dc:creator>
			<guid isPermaLink="false">5421@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I'm trying to implement a data logger, and I want to have a certain refresh rate for my sensors.  I'm trying to use modulus division for my the delay (shown below):&#60;/p&#62;
&#60;p&#62;// Delay for dataLogging&#60;br /&#62;
do&#60;br /&#62;
  {&#60;br /&#62;
    dt = millis();&#60;br /&#62;
  }&#60;br /&#62;
while(dt%logInt);&#60;/p&#62;
&#60;p&#62;Where logInt is my logging interval in milliseconds (set to 50, for 20Hz).  The issue is when I try to log my data I get results every second, for the first 20 ms.  IE, the results start printing at the start of every second, and print from 1000 to 1019 continuously (IE 1000, 1001, 1002 ... 1019)&#60;/p&#62;
&#60;p&#62;Any advice?  Is there another way to implement a delay for the sensors, or any other suggestions?&#60;/p&#62;
&#60;p&#62;Link to full code: &#60;a href=&#34;https://gist.github.com/1048063&#34; rel=&#34;nofollow&#34;&#62;https://gist.github.com/1048063&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Link to longer output sample: &#60;a href=&#34;https://gist.github.com/1048067&#34; rel=&#34;nofollow&#34;&#62;https://gist.github.com/1048067&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Thanks a ton!&#60;/p&#62;
&#60;p&#62;JR
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
