Programming help !!!

Hello, I am new to programming and I would like help to creat a program ( my objective is in attach )

DL2= Light Sensor-Grove
DL1= Light Sensor-Grove
DL3= Light Sensor-Grove

Moteur= GearMotor HP 6V Pololu #1595

I will be very grateful to you if you can help me :smiley_cat: :wink:

algrorigramme.PNG

What do DL1, DL2, and DL3 mean to you? They don't mean anything to me.

The names sens2, sens1, and Inactif are not defined in your picture, so I assume that you're just looking for some equivalent C++ code that won't compile.

void setup()
{
}

void loop()
{
   int DL2;
   int DL1;
   int DL3;
   int Moteur;

   if(DL2 > DL1 || DL3) // If the undefined value in DL2 is greater than the undefined value in DL1 or DL3 is true
   {
      if(DL1 > DL3) // If the undefined value in DL1 is greater than the undefined value in DL3
      {
         Moteur = sens2; // Cause an error since sens2 is undefined
      }
      else
      {
         Moteur = sens1; // Cause an error since sens1 is undefined
      }
   }
   else
   {
       Motuer = Inactif; // Cause an error since Inactif is undefined
   }
}

If you wanted something else, your post was woefully inadequate in describing what you want.

Thank you for your reply :smiley:

This program is going to be used for a solar tracker. When DL2 receive sun, the motor are inactive and when DL1 and DL3 are receiving sun, the motor are active until DL2 receives sun.

I have put another chart in attach.

DL are in Lux.

Please display your image(s) in your post so we can see it(them) without downloading it(them). See this Simple Image Guide

...R

It would make sense to assign values to DL1, DL2, and DL3 somewhere. Assigning a value to Moteur will be useless unless you actually use that value to make a motor do something.

Your flow chart does NOT loop.

Testing that DL2 is greater than DL1 or that DL3 is true is NOT what you want to do. You want to, apparently, do something if DL2 is greater than DL1 or if DL2 is greater than DL3. You can not meaningfully compare DL2 to (DL1 || Dl3).

Be careful: 'Motuer' is not equal to 'Moteur' There is a French forum by the way, if you're french speaker.