[VicPiMakers Projects] Make class out of functions

George Bowden gtbowdeng at gmail.com
Mon Nov 16 23:50:25 EST 2020


I got the libraries working
[image: image.png]

I made the period in the class public because I want to set its value based
on what comes back from my website.
I dont see using the getter and setter for now...
fridge11.ino does a test, slowing the blink down after 30 blinks.
All seems to work now...
you have to restart Arduino for changes in the library to be recognized.
I changed the names of the files and library so that they are all the
same... ActionTimer
Thanks for your help


On Mon, Nov 16, 2020 at 8:40 PM Mark G. <vpm at palaceofretention.ca> wrote:

> Hi George,
>
> I've managed get two lights blinking at different rates
> on an Arduino Uno.  I changed the timer test algorithm
> to something I found on the internet, which made more
> sense to me.
>
> The code is in three separate files.  They are all in the
> same folder for arduino purposes.  I may try and make a
> library in the arduino sense, that can be used in other
> projects (as you desired).  Should I see if I can?
>
> Fixes: I added an #include <Arduino.h> statement into action_timer.h
> to solve the missing millis() problem.  Here is the example
> in three files.  I am using Arduino 1.8.5 on a macos 10.14
> system.
>
> Note: you didn't need to add the parameter in the is_action_time()
> member function.  It gets the period via the constructor
> in the call to new (also changed from previous version).
>
>
> On 2020-11-15 9:37 p.m., George Bowden wrote:
> > Here is my functions version after fixing a few bugs.  Still misses some
> > blinks.
> > On Sun, Nov 15, 2020 at 8:09 PM Mark G. <vpm at palaceofretention.ca
> > <mailto:vpm at palaceofretention.ca>> wrote:
> >
> >     Quick update:
> >
> >     You probably want to add unsigned in front of
> >     all the long ints, or adjust the type as needed
> >     (all over, including  the "const" values).
> >
> >
> >
> --
> Projects mailing list
> Projects at vicpimakers.ca
> http://vicpimakers.ca/mailman/listinfo/projects_vicpimakers.ca
>


-- 
George Bowden, vice president, Victoria Computer Club
gtbowdeng at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://vicpimakers.ca/pipermail/projects_vicpimakers.ca/attachments/20201116/e23e51db/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 6811 bytes
Desc: not available
URL: <http://vicpimakers.ca/pipermail/projects_vicpimakers.ca/attachments/20201116/e23e51db/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fridge11.ino
Type: application/octet-stream
Size: 1159 bytes
Desc: not available
URL: <http://vicpimakers.ca/pipermail/projects_vicpimakers.ca/attachments/20201116/e23e51db/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ActionTimer.cpp
Type: application/octet-stream
Size: 339 bytes
Desc: not available
URL: <http://vicpimakers.ca/pipermail/projects_vicpimakers.ca/attachments/20201116/e23e51db/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ActionTimer.h
Type: application/octet-stream
Size: 451 bytes
Desc: not available
URL: <http://vicpimakers.ca/pipermail/projects_vicpimakers.ca/attachments/20201116/e23e51db/attachment-0002.obj>


More information about the Projects mailing list