#define switch_1 1
#define adj_sw 2
#define max_del 500
int getdelay();
void setup() {
pinMode(26,OUTPUT);
pinMode(27,OUTPUT);
pinMode(14,OUTPUT);
pinMode(12,OUTPUT);
pinMode(switch_1,INPUT);
pinMode(adj_sw,INPUT);
}
void loop() {
int val = getdelay();
if(digitalRead(switch_1)==true){
digitalWrite(26,HIGH);
delay(val);
digitalWrite(26,LOW);
digitalWrite(27,HIGH);
delay(val);
digitalWrite(27,LOW);
digitalWrite(14,HIGH);
delay(val);
digitalWrite(14,LOW);
digitalWrite(12,HIGH);
delay(val);
digitalWrite(12,LOW);
}
}
int getdelay(){
double voltage = analogRead(adj_sw);
return voltage/1023*max_del;
}