Timer Help


hi,´
i have timer, when button pressed activates relay time, duration regulated potenciometer.

int potpin = a1;
const int buttonpin = a2;

void setup() {
serial.begin(9600);
pinmode(ledpin, output);

pinmode(buttonpin, input);

}

void loop()
{
int buttonstate = digitalread(buttonpin);

int val = analogread(potpin);
long tempo = (val*19.550342131);
serial.print(tempo);
serial.print("tempo:");

// read value sensor
if (buttonstate==high) {

digitalwrite(ledpin, high);
delay(tempo);
digitalwrite(ledpin, low);
} else {}; // turn ledpin off

delay(500);
}

thats code, problem when press de button, arduino stops reading code while counting, can show me way keep running code, counting time?
thank you

see blink without delay example , of many tutorials on it.


Arduino Forum > Using Arduino > Project Guidance > Timer Help


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts