Need a delayed statement


at last lines of code have if statement. activates split second isn't enough. want able activate second. how change code?

int timer = 100;          
const int ledpins[] = {
 2, 7, 4, 6, 5, 3 };    

int pincount = 6;

const int analogpin = 0;    
const int threshold = 500;
const int endpin = 12;
void setup() {
 int thispin;
 for (int thispin = 0; thispin < pincount; thispin++)  {
   pinmode(ledpins[thispin], output);      
}
}


void loop() {
int analogvalue = analogread(analogpin);

 for (int thispin = 0; thispin < pincount; thispin++) {
     digitalwrite(ledpins[thispin], high);  
   delay(timer);                  
     digitalwrite(ledpins[thispin], low);    
 }
 

 // loop highest pin lowest:
 for (int thispin = pincount - 1; thispin >= 0; thispin--) {
   // turn pin on:
   digitalwrite(ledpins[thispin], high);
   delay(timer);
   // turn pin off:
   digitalwrite(ledpins[thispin], low);
   
   
   for (int thispin = 0; thispin < pincount; thispin++) {
     digitalwrite(ledpins[thispin], high);  
   delay(timer);                  
     digitalwrite(ledpins[thispin], low);    
 }
 }

 // loop highest pin lowest:
 for (int thispin = pincount - 1; thispin >= 0; thispin--) {
   // turn pin on:
   digitalwrite(ledpins[thispin], high);
   delay(timer);
   // turn pin off:
   digitalwrite(ledpins[thispin], low);
   
   
   for (int thispin = 0; thispin < pincount; thispin++) {
     digitalwrite(ledpins[thispin], high);  
   delay(timer);                  
     digitalwrite(ledpins[thispin], low);    
 }
 }

 // loop highest pin lowest:
 for (int thispin = pincount - 1; thispin >= 0; thispin--) {
   // turn pin on:
   digitalwrite(ledpins[thispin], high);
   delay(timer);
   // turn pin off:
   digitalwrite(ledpins[thispin], low);
   
   for (int thispin = 0; thispin < pincount; thispin++) {
     digitalwrite(ledpins[thispin], high);  
   delay(timer);                  
     digitalwrite(ledpins[thispin], low);    
 }
 }

 // loop highest pin lowest:
 for (int thispin = pincount - 1; thispin >= 0; thispin--) {
   // turn pin on:
   digitalwrite(ledpins[thispin], high);
   delay(timer);
   // turn pin off:
   digitalwrite(ledpins[thispin], low);
  delay(1000);
  if (analogvalue > threshold) {
    delay(1000);
  (int thispin = 0; thispin < pincount; thispin++) {
     digitalwrite(ledpins[thispin], high);  
 }
 
  delay(10000);
  }
 else {
    digitalwrite(ledpins[thispin], low);
   
 }
 
 }
}

thanks

quote
i want able activate second.


activate what?  your problem little hard understand based on you've told us.  be more specific.


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Need a delayed statement


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums