D
D
Detcelfer2019-01-25 12:18:23
Arduino
Detcelfer, 2019-01-25 12:18:23

How to dynamically create, store and access class objects?

Project description:
I'm trying to make an alarm clock based on Arduino, which should have the following features:
- create a new alarm clock
- delete the created alarm clock
- store settings in the created alarm clock (setting time, repetition days, on / off)
I imagine an array that stores class objects containing a set of variables that store information about the alarm clock.
How can one implement dynamic creation of class objects of the same type? How to work with this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
beerchaser, 2019-01-26
@beerchaser

Why create a lot of objects? What is wrong with the cron logic? To ensure the required accuracy, we look through a file of several records once per second. Those. One alarm, one entry. The recording format defines all the necessary functionality: trigger time, on/off, repeat days, ring tone, etc. Moreover, both read and write directly to the storage device. Considering that the storage device is conditionally flash and read operations will prevail, I do not see a big gain from transferring structures to memory. If only to practice. But here everything is simple - a dynamic list with pointers to objects.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question