Passing Multiple variables

Hello everyone, I'm about 40% done my project I'm working on. It is just a simple Timer with a OLED screen which will have the ability to turn off and on a relay. This is my first Coding project !!

The OLED screen will have the current time, the timer information, and if the relay is on or off to show if the light is on or off.

I will have a switch that will clear the OLED screen and display set time and set timer. This will be done with pots. I then want to pass that new information back over to the first screen. I have the interrupted working. I'm also new to programming and I know that C++ functions only allow you to return one value at a time. I did learn couple days ago about arrays and had the idea that I could return an array which would have multiple information within it. They would be the same data type hour, min,sec. However today I learned that I could also use a Data structures, which are used for different data types.

So my question is, do you think I should use an array for passing Hours,Min,Sec back back to the main OLED screen, given they are the same data type.

or use a Data Structure, and if I was going to use a data structure where would this go in the code, the .h file inside my classes?

If you want more information here is the github,

let me know what you are all thinking, I'm opening to changing my code if I have bad habits. My goal is to complete my first coding project and do it in a good code practicing way.

Thank you for your time,
Joe

You could use a struct. That will go in your main .ino file.

Or use global variables.

MorganS:
You could use a struct. That will go in your main .ino file.

Or use global variables.

Ok Great thank you MorganS, Ok I will learn how to use a Struct, and I really don't want to use any global variables.

Thank you for your time.

Global variables, while frowned upon by many, are the norm for embedded programming where space is tight. Especially large variables such as send/receive buffers are best created as global variables instead of on demand in a function. That way you're guaranteed to have a complete block of memory available to it.

wvmarle:
Global variables, while frowned upon by many, are the norm for embedded programming where space is tight. Especially large variables such as send/receive buffers are best created as global variables instead of on demand in a function. That way you're guaranteed to have a complete block of memory available to it.

Thank you wvmarle,

Wow I never thought about it like that. Hmm I will have to get that out of my head, given most books for C++ talk about not using Globals. But this is Embedded programming so a little different.

Thank you sir,

Joe