how to interupt a input?
hi
i have 1 input depends on another, when push button 1 (input d3) , button 2 (input d2) low, output (d10) turned high, if button 2 goes high, output have go low, sketch output standing high... how can change that?
my comlete (unfinished) code:
frustrated :-?
i have 1 input depends on another, when push button 1 (input d3) , button 2 (input d2) low, output (d10) turned high, if button 2 goes high, output have go low, sketch output standing high... how can change that?
my comlete (unfinished) code:
code: [select]
/*
car lifter
made håvard gjøsund
thanks arduino forum*/
const int pot1 = 0;
const int pot2 = 1;
const int brend = 2;
const int bropp = 3;
const int brned = 4;
const int brlas = 5;
const int brlys = 6;
const int ledac = 7;
const int leddc = 13;
const int ledlys = 8;
const int sollas = 9;
const int solopp = 10;
const int solned = 11;
int brstateopp = 0;
int brstatened = 0;
int brstatelas = 0;
int brstateend = 0;
void setup() {
pinmode(brend, input);
pinmode(bropp, input);
pinmode(brned, input);
pinmode(brlas, input);
pinmode(brlys, input);
pinmode(ledac, output);
pinmode(leddc, output);
pinmode(ledlys, output);
pinmode(sollas, output);
pinmode(solopp, output);
pinmode(solned, output);
}
void loop (){
// read end switch
brstateend = digitalread(brend);
//lift
brstateopp = digitalread(bropp);
if (brstateopp == high)
{
if (brstateend != high)
{
digitalwrite(solopp, high);
}
}
else
{
digitalwrite(solopp, low);
}
//lower
brstatened = digitalread(brned);
if (brstatened == high)
{
digitalwrite(solned, high);
}
else
{
digitalwrite(solned, low);
}
//retract lock
brstatelas = digitalread(brlas);
if (brstatelas == high)
{
digitalwrite(sollas, high);
}
else
{
digitalwrite(sollas, low);
}
}
frustrated :-?
we can't see brstateend got value, of relationship between d2, d3, , d10 , brup , solup.
can see of code?
can see of code?
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > how to interupt a input?
arduino
Comments
Post a Comment