Skip to main content

Questions tagged [object-oriented]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
264 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 ...
Mike's user avatar
  • 103
1 vote
1 answer
160 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 ...
Erik Weisbrod's user avatar
1 vote
2 answers
288 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 ...
sebbo111's user avatar
-1 votes
2 answers
884 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....
Simon's user avatar
  • 107
1 vote
1 answer
1k 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 ...
The_Indestructible_Cat's user avatar
0 votes
1 answer
288 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 ...
Titan's user avatar
  • 3
2 votes
1 answer
3k 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 (...
Duncan C's user avatar
  • 5,702
0 votes
1 answer
56 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 ...
Lucas Alexandre's user avatar
1 vote
1 answer
131 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); ...
jan's user avatar
  • 13
2 votes
1 answer
213 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() { } ...
walkman118's user avatar
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 ...
Samuel S's user avatar
0 votes
1 answer
296 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 ...
Hamish_Fernsby's user avatar
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 ...
ahalekelly's user avatar