In my older arduino, i has modified wavemaker for an alternated and storm.
I tried to copy the code to put in place of mode 4 in Ferduino code and i have add the night mode.
i am newbie in devellopement arduino and I can not find "periodo"
but "periodo" is too long, how I can change it to 700, 800, 900, for an example
Code: Select all
 else if(modo_selecionado == 4)
   switch (cmode){  
     case 0: times = millis();
    value = int(128 + 127 * sin(2 * PI / periodo * times));
    Pump1PWM = 0;      
    Pump2PWM = value;
   if(value == 255){cmode = 1;} // при достижении уровня 253 - перейти к case 1
     break;
      
      case 1: 
    times = millis();
    value = int(128 + 127 * sin(2 * PI / periodo * times));
     Pump1PWM = value; 
     Pump2PWM = 0; 
   if(value == 253){cmode = 2;} // при достижении значения уровня 253 - перейти к case 1   
    break;
 
    case 2: times = millis();
   value = int(128 + 127 * sin(2 * PI / periodo * times)); 
     Pump1PWM = 255; 
     Pump2PWM = 0;    
  if(value == 100){cmode = 3;} 
    break;
 
    case 3: times = millis();
   value = int(128 + 127 * sin(2 * PI / periodo * times));
      Pump1PWM = 0;
      Pump2PWM = 255; 
  if(value == 100){cmode = 4;}
    break;
 
    case 4: times = millis();
   value = int(128 + 127 * sin(2 * PI / periodo * times));
     Pump1PWM = value;
     Pump2PWM = 0; 
  if(value == 255){cmode = 5;} 
    break;
 
    case 5: times = millis();
   value = int(128 + 127 * sin(2 * PI / periodo * times));
     Pump1PWM = 0;
     Pump2PWM = value; 
  if(value == 255){cmode = 6;}    
    break;
 
    case 6: times = millis();
   value = int(128 + 127 * sin(2 * PI / periodo * times)); 
     Pump1PWM = 255;
     Pump2PWM = 255; 
  if(value == 252){cmode = 7;}
    break;
    
    case 7: times = millis();
   value = int(128 + 127 * sin(2 * PI / periodo * times)); 
     Pump1PWM = 0;  // 255
     Pump2PWM = 0;  // 255
  if(value == 20){cmode = 0;} 
    break; 
   } 
  
  else if(modo_selecionado == 5)
{
 Pump1PWM = Pump1PWM_temp;
 Pump2PWM = Pump2PWM_temp;
}
  if(Pump1PWM > 255)
  {
    Pump1PWM = 255;
  }
  else if(Pump1PWM < 0)
  {
    Pump1PWM = 0;
  }
  else if(Pump2PWM > 255)
  {
    Pump2PWM = 255;
  } 
  else if(Pump2PWM < 0)
  {
    Pump2PWM = 0;
  }
if((bled_out == 0) && (wled_out == 0) && (rbled_out  == 0) && (rled_out == 0))
  {
  analogWrite(wavemaker1, int(Pump1PWM * 0.50));
  analogWrite(wavemaker2, int(Pump2PWM * 0.50));
  }
  else
  {
  analogWrite(wavemaker1, Pump1PWM );
  analogWrite(wavemaker2, Pump2PWM );    
  }
}
Thank you in advanced

 Portal
Portal Forum
Forum Login
Login Register
Register Search
Search Contact
Contact Images
Images Videos
Videos Web Control
Web Control

 
                            
                        


 
                            
                        


 
 

