I'm working on a mini elevator which uses a distance sensor to stop on different floors and I want it to return to the first floor every time I start the program, but in order to do that it would have to happen in setup().
The thing is that it can't hapoen in setup since the distance reading is included in loop(). Is there anything I could do here?
the TO wrote that distanceReading is done inside loop
So your version would require doing the distance-reading in setup too.
Which of course is possible.
@ceesarg : Post your code. I guess your code can be improved through defining functions.
defining functions enables what J-M-L suggested
best regards Stefan