A custom structure in C++ (and various other languages) which can contain member data and functions. An instance of a class is called an object.
0
votes
1answer
27 views
How to dynamically switch between between 2 objects?
I have a 40x4 LCD which internally consists of 2 40x2 LCDs.
To control this LCD I have to create 2 LiquidCrystal objects and than later on in code decide which one to use depending on which of the 4 ...
1
vote
1answer
45 views
Use object of other class within class
I am writing a class for a project which will take care of handling any LCD updates for my project. The way I want to handle this is to initialize the LCD object in my main file, and then pass the LCD ...
0
votes
0answers
20 views
Variables not initialized in Class Constructor
I'm creating a library driver for AdaFruit's GFX library. During Constructor initialization, all the variables (set in another .cpp) are returned as zero. This code has several modular files to ...
1
vote
1answer
54 views
error: 'CLASS' does not name a type only when creating object inside another object
I'm trying to use Adafruit's LED Backpack library within a custom class. When I use the Adafruit library directly within a sketch, it compiles fine. When I use an example sketch provided with the ...
0
votes
2answers
69 views
How to prepare data structures and classes?
How can I port these structures to arduino ide, I also get error when I define pointers
// pointer to classes example
#include <iostream>
using namespace std;
class Rectangle {
int width, ...
0
votes
1answer
138 views
Calling a function that is outside of a class from inside
I have an Arduino sketch with a timer interrupt class and would like to place the TIMER2Services() function in the TimerTwoTest.ino file for easy access. On compile I get a multiple definition of tmb2 ...
4
votes
1answer
155 views
Arduino Servo won't move when using classes
I'm trying to make a class work with Arduino, however it doesn't seem to trigger properly. The code is compiling perfectly, and it's supposed to control the leg of an hexapod. Also, the example sweep ...
1
vote
1answer
99 views
Initialize a “Matrix” object in my own library?
So, I'm trying to make a custom library to drive a 8x8 Bi-Color LED Matrix from 2 MAX7219's that incorporates two "Matrix" objects from the "Matrix" library and I cannot, for the life of me, figure ...
2
votes
5answers
497 views
What overheads and other considerations are there when using a struct vs a class?
C on embedded systems has traditionally use structs to hold structured data.
Arduino brings C++ to the table, so we can use classes instead.
Lets say we have two different data structures which ...