timothysg1:
can you give me some more information how your code works?
'boolean' is a 1-bit integer type. It can contain the value 0 or 1.
'false' is equal to 0 (LOW is also equal to 0)
'true' is equal to 1 (HIGH is also equal to 1)
The '!' operator is the logical 'not' operator. false == 0 == !true, true == 1 == !false
The second argument of digitalWrite() can either be 0=false=LOW which means TURN THE OUTPUT PIN OFF or some non-zero value (like true or HIGH) which means TURN THE OUTPUT PIN ON (+5V).
'boolean' is a 1-bit integer type. It can contain the value 0 or 1.
No. From wiring.h:
typedef uint8_t boolean;
So, boolean is a byte. It can hold any value between 0 and 255. Typically, the type is chosen for variables whose meaning is true/false, but the range of values is not limited to 0 or 1.
'boolean' is a 1-bit integer type. It can contain the value 0 or 1.
No. From wiring.h:
typedef uint8_t boolean;
So, boolean is a byte. It can hold any value between 0 and 255. Typically, the type is chosen for variables whose meaning is true/false, but the range of values is not limited to 0 or 1.
You're right. I meant to use the C++ type 'bool' instead of 'boolean'.
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
if (results.value==0x8B73AC5)
{ lampOn = !lampOn; digitalWrite(13, lampOn); delay(50); };
irrecv.resume(); // Receive the next value
}
}
I want to do this:
instead of { lampOn = !lampOn; digitalWrite(13, lampOn); delay(50); }; i want let the led 13 blink if he gets the command 8B73AC5 and stop blinking
if the recever get the same command
but as I said I am a real newbie, I have no idea what a flag is
not to mention to set one, and what is the purpos (and how do you make it) of:
" add some code that checks the time and toggles the LED" ?
plz help me
It has been explained that lampOn is a flag. It can have one of two values. Surely you can figure out how to define a similar variable that defines whether the LED should be blinking, or not.
The whole purpose of the blink without delay example is to show how to do things without needing to use delay(). Have you even looked at the example?
of corse i loked at it, i am looking at it right now
but I don't understand what it has to do with what I want... I dont think the delay is important i just want to let it blink when it recives the command to ... and stop blinking if it gets the same command
You must be aware, then, that LEDs don't blink on their own. You must turn the LED on if it is time, and turn it off if it is time.
You have code that know when a particular IR signal has been received. You've been told how to change that to just record that the LED needs to blink, or not.
You have code that turns and LED on of it is time, and turns it off if it is time.
Put them together. Try something, even if it is wrong.
but ti doesn't blink
it only goes on when it gest the command to
and turns of when it gets the same command
i probably made somthing silly, did i foget sommething? i tried to
change the 1000 in "long interval = 1000; " but when i tried the command to turn it on it didn't do anything