Sorry for the noobie question but if I want to upload multiple sketches do I create multiple tabs on the IDE or just put all the code in one tab? I need to get a DS3231 RTC, I2C LED screen working with 3 24V relays for a dosing pump setup and wasn't sure if I needed multiple tabs in one sketch or how to separate them if I need to do it all in one screen! TIA!
You can only load one sketch at a time but that single sketch could do multiple things if the required memory is available to hold the sketch and its data
"How to combine sketches" must be in top ten FAQs.
Have a look at Arduino Sketch Merge - Wikiversity
If you don't care about speed or bloat you can get RTOS and learn the ins and outs of that.
Otherwise you learn to make the sketches to combine to use time-based, non-blocking code, it's down to techniques and starts with this link How to do multiple things at once -- non-blocking tutorial.
To make coding easier you should also learn about state machines. Start with simple ones, they can scale up to handle very complex jobs. But first learn to not block!
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.