I stuck with my homework so last chance I came here for help cause my teacher isn't helping so maybe you guys can help me
So my last homework is to make a program when you press the press button the red led goes on and stays on when I press for the second time on the same press button the green led goes on and stays on when I press the third time on the same press button the blue led goes on and stays on and the fourth time I press on the press button the yellow led goes on and the fifth time they blink all
when I press the button all the LEDs go on
I'm using arduino nano
LED RED = code 4
LED GREEN = code 5
LED BLUE = code 6
LED YELLOW= 7
PRESS BUTTON= 8
1st press of the push button, the LED lights up red,
2nd press of the push button, the LED lights up green,
3rd press of the push button LED lights up blue,
4th press of the push button, the LED lights up yellow,
5th press of the push button the LEDs will all flash.
Did any teacher not teach you how to write in sentences?
Or are they missing on your keyboard?
Yes you are a beginner which is why we are trying to help you, but help is a two way street, it requires some effort on your part.
Have you been playing attention for your other assignments or did you just get someone else to do them for you, like you are trying now?
You have 10 days left, how long was it set before you begin to consider it. I wouldn't take you more than an hour to go through that example and throughly learn what it does. What you are being asked to do is so simple but you seem to not to want to even engage with the problem. Tell me why you think you deserve to pass this homework?
I'm with you regarding teachers that cannot provide a resource(s) but expect you to go cold turkey. Fortunately, your assignment is easy when approached from the tasks:
Consider 4 colored paper cutouts: all have a white backside, but the frontside is different: one is red, one is blue, one is green, and one is yellow. Put the cutouts on a table with all the colors facing down. You have a photographic memory and although you cannot see the colors, you know which disk is which.
Your friend shouts "one" and you turn over the red disk.
Your friend shouts "two" and you turn over the green disk.
Your friend shouts "three" and you turn over the blue disk.
Your friend shouts "four" and you turn over the yellow disk.
Your friend shouts "five" and you jump up, turn off and on the room light a few times and YOU shout back to your friend, "That was fun, let's do it all again!"
You politely thank her for shouting the words. She looks at you funny and says, "I was not shouting words, I was shouting numbers!
You guys decide to play the game again, this time with numbers. She shouts "one" but the phone rings and after taking the call, you politely say, "I'm sorry about the interruption, but I forgot what number you shouted. She becomes very angry with you because you think more of the phone call than playing the game. She knocks all the disks on to the floor and stomps out of the house.
You make a mental note that if there is a next time, you'll use stick-tally so you will not forget where you are in the game.
Sure enough, your friend comes over the next day, you play the game. After turning over the 4th disk (yellow) You jump up, rush to the light switch, toggle the switch a few times, get confirmation she wants to play again, you return to the table and tear-off the sheet of paper and turn over the colored disks. You are ready to make your first mark... she shouts "one" and you mark your tally
and turn over the red disk. And the game continues ...
In a computer program, a button could be the "shout" and the number shouted could be a program variable that starts at 0 and increments on each press like this:
0 + buttonPress = 1
1 + buttonPress = 2
2 + buttonPress = 3
3 + buttonPress = 4
4 + buttonPress = 5
If we inspect with software the variable buttonPress, then the program logic would be:
buttonPress == 1 then turn on Red LED
buttonPress == 2 then turn on Green LED
buttonPress == 3 then turn on Blue LED
buttonPress == 4 then turn on Yellow LED
buttonPress == 5 (flash LEDs)
turn off all,
turn on all,
turn off all,
set buttonPress = 0,
go back and restart waiting for buttonPress
We would start our sketch by declaring an integer to be a counter
mrburnette and LarryD i'm very thankful to both of you guys you really helped me out god bless you ,man both of you helped me without you're help i wouldnt come out this easy out of homework thank you again