I absolutely love the way Arduino makes it easy to interact with the physical world. No matter what, you find easy to reproduce examples that do what you want in a few lines.

What I am struggling now is doning several things at once, e.g.

Reading sensors values, transfering them to the serial port, displaying stuff on a LCD display with a minimal UI, receiving stuff from the computer to display on that LCD, reading out sensors ...

Each by itself is trivial, but once you want to do several things at once, there is no more waiting with delay(),you have to take care of being "on time" for e.g. serial communications, do several things at once, but withouta real operating system to help out.

Are there "best practice" examples of more complete applications that show how to handle doing several things at once? I am sure what I want to do can be done, it is the complexity of programs that makes it hard for me.

I would love to see how other people do stuff like this, especially if it includes UIs and serial interaction with the computer.

You might get some ideas on end-to-end control from Bitlash (http://bitlash.net) and Bitlash Commander (https://github.com/billroy/bitlash-commander)

Bitlash is a scripting language for arduino that makes it easy to do a lot of little things at once. Bitlash Commander is a web interface toolkit that lets you put a web control panel on your Arduino project without too much fiddling with the serial and web plumbing.

If I told you to cook breakfast and answer the door if the doorbell rings, you wouldn't let your mom waiting outside for 30 minutes while you finish cooking the Bacon. You're given a stopwatch (millis()) and a pen and paper (variables); You should be able to multitask using those tools.

Yes your paradigm of having to do many things at once is just a personal mental roadblock. An arduino can execute instructions very fast and can make it seem as if it is doing many things at once even though it's just doing one thing at a time.

So you have a list of independent tasks that have to be performed. You just have the main loop() function work it's way done that list, each task could be just a user written function that knows how to accomplish that one task. The only requirement is that any one task is not allowed to just stop and wait or loop testing for something before doing something. If it's not time for that task to do something it just returns control back to the main loop and next time the task is called from the main loop it checks if it's now time to do something or not. The arduino functions millis() gives you a free running counter that value you can use to measure passing time intervals.

I really would love to see a more complete example of a real use-case doing LCD (or some other form of) UI, serial and some other things at once. In principle I know how it should be done, but like with the simpler examples, seeing how others do it (and do it well, unlike my own first exeriments) would help me, I think.

Are there no examples of larger projects with complete sourcecode to be examined by newbies?

It is also interesting to me how people organize code, what conventions they invent, etc.

My advice here (the programming, not cooking bacon) is to chart the program first. There are a number of ways to chart programs including the simple flowchart (which I learnt when learning Fortran) and the structure chart (which I learnt when learning Cobol).

Many many coding problems stem from us diving into the code without having thought through what it is we're trying to do, and how. And the more complex it is, the more fraught with danger it is....

Then once it's charted, maybe even flesh it out further on paper in pseudo-code. Pseudo code lets you write down the logic of the program without getting tied up in the nuances of the syntax.

And make a "coding to-do list" by mapping out the sketch (to use Arduino-speak) by typing in a heap of comments showing the structure of the code and that will remind you to code each part and not forget stuff.

Hi, This is not a great example as the code has 'evolved' rather than follow a plan but it does update an LCD Every second, respond to new lap times instantly, plays an audio count down while responding to laps and updating the LCD, operates in a menu, lap review or recording mode etc. It does so through the two mechanisms already mentioned - interrupts for laps and time/timestamps for screen and audio updates.

PM Me your email address for a zip file of the code - like I say its not text book perfect but is an example of a very usable project that has been rapidly built/evolved on Arduino -

Strongly disagree. Using interrupts is a very poor and unscaleable way to manage concurrent activities. Retrolefty has already explained how to write non-blocking code that enables a sketch to manage multiple concurrent activities in a simple structure which scales up very well. Using interrupts does not help with this problem, and just introduces a whole new layer of complexity to be dealt with.

I only provide help via the forum - please do not contact me for private consultancy.

You have to choose what you need and for what reasons. Interrupts are often required for precise timing. Non blocking code is required for optimal resource utilization. Depending on what you want to achieve you may have to do both. For non blocking code it is often a good idea to think about state engines. Here is an example that uses both a state engine AND interrupts for different purposes: http://blog.blinkenlight.net/experiments/measurements/flexible-sweep/.

If you do it right, it does. I cook bacon on a rack in the oven on 350 degrees (F, for those on the other side of the pond). No grease splatter, the the bacon always comes out crisp. It takes a bit longer than a frying pan, but, then cleanup doesn't take all day, either.

It allows you to run code at a defined repetition rate WHILE running other code.

It's useful if you want to do something at precise time intervals WHILE doing other things in the background (and don't want to worry how much time your other code uses).

All it really does is implement an ISR, but it's done with the high level library so all you do is specify the repeat rate and tell it which function to attach to (rather than complicated bit-level coding that would otherwise be required).