Questions tagged [object-oriented]
The object-oriented tag has no summary.
13 questions
0
votes
1
answer
331
views
Accessing funcition in object via `->` is crashing (resetting) Arduino
I have several classes that call each other running on an Arduino Mega. I am using the ArduinoSTL library to get the std library, most notably the std::vector.
The core problem is as follows: my ...
1
vote
1
answer
183
views
Object composition (class uses class)
I would like to write a class which utilises another class and it´s member functions. I found out that this is object composition and read some examples of how to do it but it ither doesn´t work for ...
1
vote
2
answers
355
views
Detecting different objects closeness
iam currently working on a new project, where i would like to detect the existence/closeness of several objects around the arduino up to like 1 meter. I was thinking about an rfid setup, but as the ...
-1
votes
2
answers
1k
views
How to properly put a u8g2 handle in a class
I'm trying to create a small battery powered alarm clock using an Arduino MKRZero and a generic SH1106-controlled, 128x64 pixel oled.
I started out just dumping all code into a single file named Clock....
1
vote
1
answer
2k
views
request for member 'attribute' in 'object', which is of non-class type 'int'
I am trying to create a basic snake game using the arduino UNO along with the MAX72XX module, the LCD module and the analog joystick module. I am wanting to program my program using object orientated ...
0
votes
1
answer
324
views
Using a class inside of another class [closed]
I have a seemingly simple problem that seems to be popular, but after searching several forums I still have not found the answer: How do you use a class inside of another class?
I have simplified my ...
2
votes
1
answer
4k
views
Does Arduino C++ support dynamic arrays of objects
My C++ is seriously out-of-date, and I'm working on a project that will be juggling multiple timed actions at the same time, with a menu system to manage the interface and control those timed actions (...
0
votes
1
answer
84
views
How to create objects with their own variables? [closed]
So i created a class and when i created objects and use them, they seem to share their variables between each other ( the currentReading, previousReading and the time variable). how can i create ...
1
vote
1
answer
150
views
Problems with passing objects in tree structure [closed]
I'm new to C++ and arduino. I want to build an object Tree, but it did not behave like I expected. Here is the code:
TreeNode.h
class TreeNode {
public:
TreeNode(String inputNodeName);
...
2
votes
1
answer
216
views
Can the TimedAction library be used to call functions of an object
Currently to use TimedAction for a function a program would look like so:
#include <TimedAction.h>
void functionX();
TimedAction funtionTimed = TimedAction(1000, functionX);
void setup()
{
}
...
3
votes
1
answer
2k
views
How do string pointers work in Arduino?
To the best of my understanding, when I declare
String s = "This is a string.";
what happens is that space is allocated on the stack for a pointer which points to some String object which internally ...
0
votes
1
answer
340
views
Passing reference to hardware between methods in custom class
I'm a C++ / Arduino newbie, trying to build a custom library for the first time. I created a unit called CDSensors.cpp, which has two methods, SetupSensor and ReadSensors. The sensor is a SparkFun ...
2
votes
1
answer
1k
views
Creating public instance of class in another class's initialization
I'm using several TM1637 displays to create timers, so I decided to make a Timer class. Every time I initialize an instance of the Timer class, I want it to create an instance of the TM1637Display ...