Timeline for LED fading effect using a push button
Current License: CC BY-SA 3.0
23 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 17, 2020 at 8:21 | history | edited | CommunityBot |
Commonmark migration
|
|
| Jun 2, 2020 at 20:37 | comment | added | Duncan C | Your pull-down resistor on your button should be on the other side of the switch, and 1K is too low. You'll waste power. Use a 10K resistor instead. Or, as the other poster said, skip the resistor, invert your logic, and use INPUT_PULLUP mode. | |
| May 24, 2017 at 10:16 | answer | added | dannyf | timeline score: 0 | |
| Apr 19, 2017 at 17:38 | vote | accept | MrDeepThought | ||
| Apr 19, 2017 at 16:13 | answer | added | rvbarreto | timeline score: 2 | |
| Apr 19, 2017 at 9:01 | history | edited | MrDeepThought | CC BY-SA 3.0 |
added 316 characters in body
|
| Mar 23, 2016 at 9:54 | comment | added | frarugi87 |
@electromaniac That button is absolutely wrongly wired.... My suggestion, however, is to use a reverse logic: wire the button between pin 8 and ground, get rid of the resistor, then enable the internal pullup (pinMode(pushbutton,INPUT_PULLUP);). When you are reading the button, just invert the logic (digitalRead == LOW means that the button is pressed). Then I suggest you to use the Bounce2 library to debounce the button (search for it on google). And then, there are lots of problems (for instance brightness = 0 should be brightness == 0)
|
|
| S Mar 22, 2016 at 19:27 | history | suggested | rebatoma | CC BY-SA 3.0 |
edits in the form of the question
|
| Mar 22, 2016 at 17:20 | review | Suggested edits | |||
| S Mar 22, 2016 at 19:27 | |||||
| Mar 22, 2016 at 17:10 | comment | added | MrDeepThought | yep i got it wrong there... | |
| Mar 22, 2016 at 17:07 | vote | accept | MrDeepThought | ||
| Mar 27, 2016 at 10:46 | |||||
| Mar 22, 2016 at 17:07 | comment | added | Gerben |
I think you meant to write buttonstate=HIGH; instead of digitalWrite (buttonstate,HIGH);
|
|
| Mar 22, 2016 at 17:06 | answer | added | ARK | timeline score: 2 | |
| Mar 22, 2016 at 17:04 | answer | added | Gerben | timeline score: 3 | |
| Mar 22, 2016 at 16:53 | comment | added | Majenko |
i used it to let the button state as high even after i leave the pushbutton so that the LED doesn't get off !! well it doesn't. I don't know how you thought that might work. You're actually writing HIGH to either pin 0 or pin 1.
|
|
| Mar 22, 2016 at 16:52 | comment | added | MrDeepThought |
bro brightness doesn't matter i can change it any time to 5 or something low.......and about digitalWrite (buttonstate,HIGH); i used it to let the button state as high even after i leave the pushbutton so that the LED doesn't get off !!
|
|
| Mar 22, 2016 at 16:51 | history | edited | Gerben | CC BY-SA 3.0 |
added 99 characters in body
|
| Mar 22, 2016 at 16:48 | answer | added | Majenko | timeline score: 0 | |
| Mar 22, 2016 at 16:45 | comment | added | Majenko |
int fadeamount = 51; - That's a huge amount to fade by...
|
|
| Mar 22, 2016 at 16:44 | comment | added | Majenko |
digitalWrite (buttonstate,HIGH); - What is that supposed to achieve?!
|
|
| Mar 22, 2016 at 16:43 | comment | added | Majenko | Where's the resistor on your LED? | |
| Mar 22, 2016 at 16:41 | review | First posts | |||
| Mar 24, 2016 at 13:09 | |||||
| Mar 22, 2016 at 16:39 | history | asked | MrDeepThought | CC BY-SA 3.0 |