hello Fernado
I wanted to know if it was possible to create a way of wavemaker pumps alternated in this way
Pump 1: 0
pump 2: 0 to max then returns to 0
pump 1: 0 to max then returns to 0
pump 2: 0
and so on ....
I can not create the code
value = int(128 + 127 * sin(2 * PI / periodo * times));
Pump1PWM = 255 - value;
Pump2PWM = 0;
Pump1PWM = 0;
Pump2PWM = 255 - value;
// Global variables
unsigned long millis_step = 0;
byte step = 0;
int step_time = 1000; // milliseconds
else if (modo_selecionado == 5)
{
if (step == 0)
{
if ((millis() - millis_step) > step_time)
{
Pump1PWM += 1;
Pump2PWM = 0;
millis_step = millis();
}
if (Pump1PWM == 255)
{
step = 1;
}
}
else if (step == 1)
{
if ((millis() - millis_step) > step_time)
{
Pump1PWM -= 1;
Pump2PWM = 0;
millis_step = millis();
}
if (Pump1PWM == 0)
{
step = 2;
}
}
else if (step == 2)
{
if ((millis() - millis_step) > step_time)
{
Pump1PWM = 0;
Pump2PWM += 1;
millis_step = millis();
}
if (Pump2PWM == 255)
{
step = 3;
}
}
else if (step == 3)
{
if ((millis() - millis_step) > step_time)
{
Pump1PWM = 0;
Pump2PWM -= 1;
millis_step = millis();
}
if (Pump2PWM == 0)
{
step = 0;
}
}
}
Users viewing this topic: No registered users and 0 guests