Door programming problem in automatic operation

I took a look into your code.
The code is hard to read because you are using non-selfexplainable names and numbers

example

                digitalWrite(RelayPin1, HIGH);
                digitalWrite(RelayPin2, HIGH);

RelayPin1 and 2 switch something on / off What is it what gets switched on/off?

a ventilator, a lamp?, an egg-boiler? No idea from the word RelayPin1

The name should be selfexplaining.

you use a switch-case-statement

    switch( state_relais_manuel )
    {
        case    1:
            // On allume l'un des relais alors que l'autre est éteint...

the number itself says nothing.
Your comment says nothing too. Switch one relay on the other off

What does happen if you have done

            digitalWrite(RelayPin1, LOW);
            digitalWrite(RelayPin2, HIGH);

is the swimming-pool-heating switched on or your feather-shaving-propeller switched off?

I'm using nonsense-examples to emphasise on the non-explaining-character of your symbols.

This makes it hard to understand what your code does. Especcially for other who try to help you and for the person who will judge about your project.

I offer you to help under the pre-condition of changing all names to a self-explaining style. Rewriting your code in this way will take less time than explaining what Relay1Pin1 etc. etc. etc. means. Especcially if you add the time it needs until you receive answers.

It is up to you if you want to go in encrypting your code on your own
or

getting cooperative by renaming each and every symbol in a selfdescriptive style.

If you have questions about how to do the renaming just ask.

best regards Stefan

1 Like