Beyond Basic Arduino: Creating Custom Functions for Multiple Returns

preview_player
Показать описание
Join this channel to get access to perks:

If you like this content and you want to support me in creating similar videos go to my Patreon webpage
Or

This video is the short introduction to creating your own custom functions in Arduino.
It starts with very simple example to move then to more complex functions which return multiple values, using a simple trick with memory pointer.
Hope you will find this ideo usefull.
Рекомендации по теме
Комментарии
Автор

How do you not have more views? this is very entertaining and informational

pizzagod
Автор

Very interesting! I bookmarked and will watch again.

lint
Автор

just what i need for my clock project using the 4 digit Adafruit alphanumeric display

TheUnofficialMaker
Автор

Thank a lot for such clear explanation!

gurupavel
Автор

Cool, really cool. And very useful. Thank you.

johneagle
Автор

Hey 👋
Isn't it possible to create some kind of custom type on Arduino? An object with properties “sum” and “mul”.
If so, you just need to create the object inside a function and return it.

Because it doesn't seem to be a good practice to use pointers for a case you've described. And I'm pretty sure it's possible to create custom type in C, which means it must be available on Arduino.
As analogy, you may also check the data type called “object” in JS.

satoshinakamoto
Автор

Hello,

I made also a program. And it worked!!!

How can you use an timer in an fuction using Millis. I can not get it to work. I stript my program only tot the timer.


#define PinLed 6

bool xBlinkOn;

void Test();

void setup() {
pinMode(PinLed, OUTPUT);
}

void loop() {
Test(millis(), &xBlinkOn);

digitalWrite(PinLed, xBlinkOn);
}

void Test(unsigned long time, bool* xOutput){
unsigned long timeBlink;
bool xInit;

if (xInit== 0)
{
timeBlink = time;
xInit = 1;
}

if ( time - timeBlink >= 500)
{
*xOutput = !*xOutput;
timeBlink = time;
}
} //Test

edje