int ledPin = 13; // LED connected to digital pin 13
int inPin = 7; // pushbutton connected to digital pin 7
int val = 0; // variable to store the read value
int pot = A0;
int potval = 0;
int dwell = 0;
int soakvalue = A1;
int soakdwell = 0;
int impulse = 12;
int impulseval = 0;
int soak = 11;
int soakval = 0;
char buffer[40];
void setup() {
pinMode(ledPin, OUTPUT); // sets the digital pin 13 as output
pinMode(inPin, INPUT); // sets the digital pin 7 as input
pinMode(pot, INPUT);
pinMode(soakvalue, INPUT);
pinMode(impulse, OUTPUT);
pinMode(soak, OUTPUT);
Serial.begin(9600);
}
void loop()
{
potval = analogRead(pot); //sensor value of the dwell pot
dwell = map(potval, 0, 1023, 0, 7000); // scales the scales the pot 0-5 seconds.
soakval = analogRead(soakvalue); //soak dwell pot raw value
soakdwell = map(soakval, 0, 1023, 0, 5000);
val = digitalRead(inPin);
sprintf(buffer, "Dwell = %d, Soak = %d", dwell, soakdwell);
Serial.println(buffer);
if (val == HIGH)
{
digitalWrite(ledPin, HIGH);
delay(3000);
digitalWrite(impulse, HIGH);
delay(dwell);
digitalWrite(impulse, LOW);
digitalWrite(soak, HIGH);
delay(soakdwell);
digitalWrite(soak, LOW);
digitalWrite(ledPin, LOW);}
}