second void loop?

Hey guys,

I'm gonna use an arduino for my new project..
the big purpose of it will be to remotely control my device.

here are a few things to make my question clear (at least I hope so)

for starters. my device will be powered by 230v, this input has got a true on/off switch.
if this switch is on the device will be in stand-by mode.

in stand-by mode half of the 230v will be stopped by a relay.
the other half will be decreased to 12v dc, this will power a LED to show the stand-by mode
(so far nothing arduino related)

the 12v will continuly power the arduino, here comes the catch
I've got a push button which empowers the relay signal channel.

if the relay signal channel == 0 (RSC for short)
the arduino should only be able to read the push button AND the on/off button on a remote (due to IR)

both the physical button and the remote button are able to change the RSC to 1

let's say I've got two push buttons, one for the relay and one for a LED.
if RSC ==0 only the relay button works if RSC == 1 the LED button works and the relay button is reversed (to turn everything off)

so short story
if RSC == 0 nothing works except for the relay switch (physical and remotely)
if RSC == 1 all the scripts programmed work

so... there is my question.
is it possible to create a void loop with an if statement

void loop 1; if RSC == 0 "I'm working"
void loop 2; if RSC == 1 "I'm working"

or should I use only one loop and make a HUUGGE if statement
if RSC == 0 "nothing works except powering me up"
if RSC == 1 "everything works"

hope its clear for you guys what I mean to do

kind regards!

One loop function.

No huge “if”,

I got stuck at this bit:

Me too.

loop() is a function and a program cannot have two functions with the same name. Provided you use separate names you may have as many functions as you like. Have a look at Planning and Implementing a Program


Hey guys,

Thanks for the replies..

Found some ways to do it


Can I suggest you approach one project at a time.

To quote;

I'm quite new in the world of arduino but I challenged myself in using an arduino for my new little project.

To many "little" projects...

Tom.... :slight_smile: