<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div>
<div>
<div dir="ltr" style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
“As yet undetermined” meaning for instance, once attributed say to u mark aka space boy with no “slicing” words/intents but rather leap frogging to/for back/forth , again intent wouldn’t this suggest time 🧭 travel? Does this make sense? </div>
<div dir="ltr" style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Further, re: attached clock with no numbers/arms thereby “opening” rather than closing time...</div>
</div>
<div><br>
</div>
<div class="ms-outlook-ios-signature"></div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Michelle Wiboltt <michellewiboltt@outlook.com><br>
<b>Sent:</b> Sunday, November 15, 2020 8:11:10 PM<br>
<b>To:</b> Talk about Raspberry Pi / embeded projects <projects@vicpimakers.ca><br>
<b>Subject:</b> Re: [VicPiMakers Projects] Make class out of functions</font>
<div> </div>
</div>
<div>
<div>
<div>
<div dir="ltr" style="color:rgb(0,0,0); background-color:rgb(255,255,255)">Unsigned / shouldn’t it read “as yet unattributed” </div>
</div>
<div><br>
</div>
<div class="x_ms-outlook-ios-signature"></div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Projects <projects-bounces@vicpimakers.ca> on behalf of Mark G. <vpm@palaceofretention.ca><br>
<b>Sent:</b> Sunday, November 15, 2020 8:08:53 PM<br>
<b>To:</b> projects@vicpimakers.ca <projects@vicpimakers.ca><br>
<b>Subject:</b> Re: [VicPiMakers Projects] Make class out of functions</font>
<div> </div>
</div>
<div class="x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="x_PlainText">Quick update:<br>
<br>
You probably want to add unsigned in front of<br>
all the long ints, or adjust the type as needed<br>
(all over, including  the "const" values).<br>
<br>
<br>
On 2020-11-15 7:13 p.m., Mark G. wrote:<br>
> Hi George,<br>
> <br>
> Here's a quick outline of an ActionTimer class.  What<br>
> do you make of it?<br>
> <br>
> Mark<br>
> <br>
> <br>
> On 2020-11-15 6:07 p.m., George Bowden wrote:<br>
>> I have two "identical" functions for time slicing the Arduino loop.  <br>
>> One function is called to see if it is time to toggle the LED every <br>
>> second, and the other "identical" function is called to see if it is <br>
>> time to send a post to the website every few minutes.  These functions <br>
>> seem good candidates for a single C++ class, and I'm looking for some <br>
>> advice, never having coded a class before.  Maybe it's a coding <br>
>> challenge? I'm using Arduinos millis() which increments continuously <br>
>> and the modulus of that, with a different period value passed to the <br>
>> functions, to determine when to act.  When the modulus remainder is <br>
>> smaller than the last time through the loop, it is time to take <br>
>> action. (the vertical line in the stairs)<br>
>><br>
>> image.png<br>
>><br>
>><br>
>><br>
>> Each instance of the class needs its own static variable for the value <br>
>> of mod'ed millis() last time through the loop.   I would like to write <br>
>> a class which I instantiate with NEW for each different period, ....  <br>
>> I would like to put these in a library that I could include in any of <br>
>> my projects that need time sliced<br>
>><br>
>>   Here is how I have coded it as functions:<br>
>><br>
>> unsigned long lastPostMillis=0;  // the value of the modulus last time <br>
>> through the loop.<br>
>> unsigned long lastBlinkMillis=0;<br>
>><br>
>> bool isPostTime(unsigned long int period){<br>
>>    if(millis() % period > lastPostMillis) {<br>
>>      lastPostMillis = millis()% period;<br>
>>      return true;<br>
>>    }<br>
>>    else {<br>
>>      lastPostMillis = millis() % period;<br>
>>      return false;<br>
>>    }<br>
>> }<br>
>> bool isBlinkTime(unsigned long int period){<br>
>>    int blinkPeriod = 500;<br>
>>    if(millis() % blinkPeriod > lastBlinkMillis) {<br>
>>      lastBlinkMillis = millis()% period;<br>
>>      return true;<br>
>>    }<br>
>>    else {<br>
>>      lastBlinkMillis = millis()% period;<br>
>>      return false;<br>
>>    }<br>
>> }<br>
>> void setup() {...<br>
>> }<br>
>> void loop() {<br>
>>    if (isPostTime(minutesBetweenPosts*60000)) { //time to send a Post <br>
>> to the website<br>
>>    ...<br>
>>    if(isBlinkTime(500)){<br>
>>      toggle builtin led}<br>
>> } // end loop<br>
>> -- <br>
>> George Bowden, 250-893-7423<br>
>> gtbowdeng@gmail.com<br>
>> <<a href="mailto:gtbowdeng@gmail.com">mailto:gtbowdeng@gmail.com</a>><br>
>><br>
> <br>
<br>
-- <br>
Projects mailing list<br>
Projects@vicpimakers.ca<br>
<a href="https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvicpimakers.ca%2Fmailman%2Flistinfo%2Fprojects_vicpimakers.ca&amp;data=04%7C01%7C%7C28c17d64771144556b9208d889e57023%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637410965828698810%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=t7JFyoU37YhMIJ7G7vMOMsrs5RK6S3KJwkCPtxEx5hg%3D&amp;reserved=0">https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvicpimakers.ca%2Fmailman%2Flistinfo%2Fprojects_vicpimakers.ca&amp;data=04%7C01%7C%7C28c17d64771144556b9208d889e57023%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637410965828698810%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=t7JFyoU37YhMIJ7G7vMOMsrs5RK6S3KJwkCPtxEx5hg%3D&amp;reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>