Skip to main content

Questions tagged [callbacks]

This refer to the call back procedure in computer programming.

Filter by
Sorted by
Tagged with
0 votes
1 answer
105 views

How do I write efficient callback functions on a Teensy 4.0?

I am looking at refactoring my code by implementing callback functions in order to be able to reuse the abstract logic of other functions/classes. However, I feel I need to learn more about the limits ...
Erik's user avatar
  • 259
2 votes
0 answers
144 views

Program crashes when calling external library code via function pointer

I've written a user library for the Pi Pico that uses the TaskScheduler library to abstract timing away from the user. The user provides a function in their sketch which the library calls periodically ...
Joe of Loath's user avatar
1 vote
2 answers
193 views

Array of Functions

I'm new to C++. How to make a menu without if() {} else {} & switch() case? I made a menu on an array, but for some reason it doesn't compile. How to correct it? typedef void (*cbd)(uint8_t, ...
Andre's user avatar
  • 27
1 vote
2 answers
2k views

Call functions of one class from another class - Callback

I am new to C++ & I need to call functions of one class from another class. And so that the classes do not know anything about each other. How to do it in Arduino environment? class Encoder { ...
Andre's user avatar
  • 27
-1 votes
1 answer
86 views

Share interrupt service between class

I would like to share interrupt routine between class. I followed this tutorial. But I need to call a member function in callback function, I have the issue : This is my code : Timer.h static void (*...
oAGAo's user avatar
  • 3
0 votes
3 answers
828 views

Trigger event onRelease of button

I am using the EasyButton library to detect button presses on an arduino. I want do execute a function when the user Presses a button Presses and holds a button Releases a button Detecting when a ...
spuder's user avatar
  • 111
0 votes
1 answer
822 views

Passing a method pointer

I created a small library, which takes a callback function: MyClass::add_callback(bool (*callback_function)(), byte behaviour) { // ... bool result = callback_function(); // ... } So far, I'm ...
MacFreek's user avatar
  • 103
4 votes
1 answer
3k views

How to get variable from callback function?

There is a library davetcc / IoAbstraction. The only library working as expected with my rotary encoder. The problem that on rotation I can only see serial output with position data, but I cannot get ...
max5555 max5555's user avatar
0 votes
1 answer
300 views

Use callbacks in Arduino with pointers to functions (will functions persist in memory?)

As I been learning Arduino (micro controllers, c++, etc) I have learned that memory is very limited. I already understand how memory works when it comes to variables. But I do not understand how ...
Tono Nam's user avatar
  • 938
0 votes
2 answers
1k views

Parent class callback from child class

I want the Parent class to pass a pointer to a callback function to the child class when the child class is created. I got this working when the parent was the sketch thanks to this post: In this ...
Bob Jones's user avatar
  • 131
1 vote
2 answers
2k views

Callback functions when using a class

This question is somewhat similar to How to pass non-static class member to callback?, but there are a few differences, especially since a lot of my uses have "interesting" additional complexities. I'...
user avatar
2 votes
1 answer
3k views

Passing non-static member function using bind

I'm using the GxEPD2 library to communicate with an E-Paper display. I now wanted to use the drawPaged method of this library with an object display. I also have written my own class from which I ...
Lithimlin's user avatar
  • 145
0 votes
1 answer
816 views

Using timer classes within classes

I am trying to develop a class for a pump that works on a stepper motor, it should be simple but its not working the way I thought it would. Once I move the timer object into the class the code wont ...
cameroony's user avatar
4 votes
2 answers
4k views

How to pass variables to custom callback functions

I want to use the Ticker library of the ESP8266 Arduino core to (asynchronously) delay the switch of a pin to a desired state like below. I am not sure about the "here is" function definitions and I ...
milkpirate's user avatar
1 vote
2 answers
3k views

ESP8266 ASyncTCP class example

I am new to ESP programming on Arduino, as before I was developing on eLua. There were some memory problems in Lua, so I decided to move to Arduino. After looking at some examples, I found a library ...
mansoor's user avatar
  • 11
0 votes
1 answer
335 views

Typedef Function Pointer Invoking Issue

I'm having an issue trying to use a normal non-member function of my main sketch file as a callback. I can't get the function pointer to invoke from a function other than it was saved. More info ...
BruceBannor's user avatar
6 votes
2 answers
12k views

User callback functions

I want to write a class that allows the user to attach his own function to a member function that listens for messages coming from a wireless module, so that the user's function can be called ...
Vasil Kalchev's user avatar
3 votes
1 answer
5k views

What are the parameters of the browseUrl() callback in the Ethercard library?

I'm reading a code that uses Arduino as a webclient and when he tries to catch the info from the site, he uses a callback with the following parameters: static void response_callback (byte status, ...
Vinícius Affonso's user avatar
5 votes
1 answer
3k views

Non-blocking MQTT library

Are there any MQTT libraries that do not block while connecting? I'm currently using PubSubClient, and the connection part contains this code: https://github.com/knolleary/pubsubclient/blob/master/...
Stephen Denne's user avatar
1 vote
1 answer
3k views

Pass class's public function as an argument to external command

I am trying to write a library for encoders. main.ino: #include <./Encoders.h> Encoders encoders(); void setup(){ Serial.begin(9600); } void loop(){ Serial.print("&...
Marcel's user avatar
  • 181
0 votes
4 answers
947 views

Array of Strings and Callbacks

I am trying to create an array of structs that contain pairs of Strings and Callbacks the problem I am having is assigning the callback function. I have the following code: #define UI_ROUTINE_ITEMS ...
Andy Braham's user avatar