Skip to main content

Questions tagged [class]

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.

22 votes
5 answers
79k views

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 ...
Cybergibbons's user avatar
  • 5,430
21 votes
3 answers
9k views

I have no previous experience with C++ or C, but know how to program C# and am learning Arduino. I just want to organize my sketches and am quite comfortable with the Arduino language even with its ...
heltonbiker's user avatar
7 votes
1 answer
1k views

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 ...
Francisco Presencia's user avatar
6 votes
2 answers
31k views

Hi fellow programmers, I started to program Arduino a little deeply and popped out the following error when I was writing a class to read the pulses of a Hall effect flow rate sensor: SensorDeVazao....
Bruno Lobo's user avatar
4 votes
2 answers
24k views

Given the following enums enum RelayState { RELAY_OFF = HIGH, RELAY_ON = LOW }; enum class CrossingZoneState: uint8_t { CROSSINGZONE_CLEAR = 0, // no train in crossing area, also initialized ...
dinotom's user avatar
  • 360
4 votes
2 answers
15k views

I was coding a class for "a kind of gun". I have this code for the classes: Gun.h: #ifndef Gun_h #define Gun_h #include "Arduino.h" class Gun { public: Gun(String identifier, String name, int ...
Arnyminer Z's user avatar
3 votes
2 answers
3k views

I intended to use a timer interrupt for limited instances of a class in my ESP32 Arduino project. My first code conception was as follows: portEXIT_CRITICAL_ISR(&lock0); } ...
Hamid s k's user avatar
  • 143
3 votes
1 answer
57 views

I have a program where a device registers itself with a command object. The command object is losing track of the registrations. The following program repeats "0 devices registered" even though when ...
CarbonMan's user avatar
  • 233
2 votes
1 answer
8k views

I am trying to pass a class internal function as a callback function within the class. The error behavior is similar to this problem. Whatsoever, I was unable to construct working code based on that ...
Faultier's user avatar
  • 143
2 votes
2 answers
2k views

How come I never see any Arduino Library expose some of it's internal variables as public in the header file? I only see functions which are declared as public, while every variable is declared ...
Henry's user avatar
  • 123
2 votes
1 answer
842 views

At the moment I try to make a library which uses attachInterrupt(?,?,RISING) to read a sensor. The article of Nick Gammon on Calling an ISR from a class helped me a lot, but his "Glue routines" get ...
Adrian Immer's user avatar
2 votes
2 answers
43k views

I am trying to set the status of an object from a private enum and I'm not sure how to get the private member to the public version in the constructor, and I'm pretty sure I should not be using byte ...
Rob Hilken's user avatar
2 votes
1 answer
2k views

I'm trying to create a class that uses attachInterrupt, but get this error msg: In member function 'void ledDoor::attach()': ClosetLedStrip:31:82: error: invalid use of non-static member function ...
guyd's user avatar
  • 1,049
2 votes
1 answer
3k views

I'd like to know if it's possible to create a library for Arduino that does not contain a class, just functions. I know how to create a library with a class, but I'd like to create a library of ...
Killerb81's user avatar
2 votes
1 answer
69 views

I am writing a project that involves using complementary filters to combine gyroscope and accelerator readings in 3 directions. The relevant code is below. class CompFilter { public: long ...
Charles Vorbach's user avatar

15 30 50 per page
1
2 3 4 5
9