Boolean Variables
hello, have few questions variables. please understanding not experienced programmer.
i read digital input, store boolean variable.
could accomplish
i thought first work because high , true both equal 1, wanted make sure. thanks!
i read digital input, store boolean variable.
could accomplish
code: [select]
boolean variable = digitalread(pin)
or have along lines of code: [select]
if(digitalread(pin)==high){
boolean variable = true;
}
i thought first work because high , true both equal 1, wanted make sure. thanks!
quote
could accomplish
yes, because values returned digitalread(), high , low, correspond, value-wise, true , false.
if concerned digitalread() returning other values in future, use:
code: [select]
boolean flag = (figitalread(somepin) == high);
to set flag true when digitalread() returns high.
Arduino Forum > Using Arduino > Programming Questions > Boolean Variables
arduino
Comments
Post a Comment