Plz help me ...
I need code when i press push button led 1 and led 2 on
And when i press again led 1 off but led 2 after 10 second off .
Thank you
Plz help me ...
I need code when i press push button led 1 and led 2 on
And when i press again led 1 off but led 2 after 10 second off .
Thank you
(deleted)
for switch input have a look at
and when you are looking at timing events
شفتك سمير
There are many tutorial examples that will get you very close if you type in "Arduino LED toggle" into YouTube and follow along.
JB
Try this:
/* Plz help me ...
* I need code when i press push button led 1 and led 2 on
* And when i press again led 1 off but led 2 after 10 second off .
*
* Attach button between pin 8 and gnd
* Attach LED1 between pin 9 and ground, with current limiting resistor
* Attach LED2 between pin 10 and ground, with current limiting resistor
*/
const byte OnValue = 0xF9;
void setup() {
DDRB = 38;
PORTB = 1;
}
void loop() {
while(digitalRead(8));
PORTB |= ~OnValue;
delay(20);
while(!digitalRead(8));
delay(20);
while(digitalRead(8));
PORTB &= ~2;
for (byte cursor = 0;; ++cursor)
{
byte mask;
byte blinkyChar = "\27\4\7\7\11\10\1\12\17\x1A\15\10\1"[cursor];
delay(150);
if (!blinkyChar--)
{
PORTB &= -5;
return;
}
if (!blinkyChar--)
{
delay(75 * 6);
continue;
}
for (mask = 2; blinkyChar >= mask; mask <<= 1)
blinkyChar -= mask;
for (mask >>= 1; mask; mask >>= 1)
{
PORTB |= 040;
delay(75);
if (blinkyChar & mask)
delay(150);
PORTB &= 0337;
delay(75);
}
}
}
Wait until the professor sees that one.
I can’t find anything like this in youtube
Nawar94:
I can’t find anything like this in youtube
Was your assignment to find it on Youtube or write it yourself ?
Nawar94:
I can’t find anything like this in youtube
The professor checked that before handing out the assignment.
It’s between your ears.
We can help with the sketch you have, please show us what you have written.
.
Nawar94:
I can’t find anything like this in youtube
The suggestion wasn't that you can find exactly what you need on YouTube. The suggestion was that you could find tutorials that would help you LEARN how to do exactly what you need.
If you don't want to learn, I can't help you.
JB
Did you try the code I posted? It should work.
Jimmus:
Did you try the code I posted? It should work.
The OP is afraid that the professor will ask how it works.
aarg:
The OP is afraid that the professor will ask how it works.
Maybe this is the professor.
.