Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to pass to funtion #97

Closed
BernhardSchlegel opened this issue Jun 11, 2022 · 2 comments
Closed

Question: How to pass to funtion #97

BernhardSchlegel opened this issue Jun 11, 2022 · 2 comments

Comments

@BernhardSchlegel
Copy link

BernhardSchlegel commented Jun 11, 2022

Hey there,

I've created a JLed, I.e. using

auto my_led = JLed(GPIO_LED).LowActive().Off();

How do I pass that to a function

void fooFunction($WHAT_GOES_HERE$ led) { ... }

I've tried jled::JLed::TJLed, jled::JLed, auto ... nothing works. (I.e. resulting into error: use of deleted function 'jled::JLed::JLed()')

Thanks!

@jandelgado
Copy link
Owner

The type is simply JLed, so you could for example pass a reference with something like (make sure to a recent JLed version):

#include <jled.h>

auto led = JLed(LED_BUILTIN).Blink(1000, 1000).Repeat(5);

void dosomething(JLed& led) {
    led.Stop();
}

void setup() {
}

void loop() {
  led.Update();
  dosomething(led);
}

@github-actions
Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants