Timeline for How do I run 4 LEDs sequentially based off of a push button input?
Current License: CC BY-SA 4.0
17 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 26, 2022 at 23:04 | comment | added | Michel Keijzers | Let us continue this discussion in chat. | |
| Jan 26, 2022 at 23:04 | history | edited | Michel Keijzers | CC BY-SA 4.0 |
deleted 238 characters in body
|
| Jan 26, 2022 at 23:03 | comment | added | Myles | so do i only need 2 case statements then? | |
| Jan 26, 2022 at 23:02 | history | edited | Michel Keijzers | CC BY-SA 4.0 |
deleted 238 characters in body
|
| Jan 26, 2022 at 23:02 | comment | added | Michel Keijzers |
You are right about the switch statement, I converted it/combined it with the previous if statement. I also fixed a 'bug' where I had two methods named equal. And the reason why to add +1: If you see the function ProcessLedsState, you see if (millis() > _time + DURATION) ... when it's equal it wouldn't trigger immediately, so I added 1. Maybe instead using >= would be better, as you probably want to change LEDs every 300 ms, not when it's (necessarily) more than 300 ms.
|
|
| Jan 26, 2022 at 22:57 | history | edited | Michel Keijzers | CC BY-SA 4.0 |
deleted 238 characters in body
|
| Jan 26, 2022 at 22:53 | comment | added | Myles | what is the point of have those case statements if the code just falls through. I also do not understand why you add 1 to t in the first if statement in void ProcessState(). Can you explain please? | |
| Jan 25, 2022 at 22:56 | comment | added | Myles | Awesome, I will check that code out and try to implement the parts that I can understand. You have been a great help thank you. | |
| Jan 25, 2022 at 22:48 | comment | added | Michel Keijzers | Check the update, I optimized the sketch. | |
| Jan 25, 2022 at 22:47 | history | edited | Michel Keijzers | CC BY-SA 4.0 |
added 1824 characters in body
|
| Jan 25, 2022 at 21:59 | comment | added | Michel Keijzers |
Change SwitchLedsOff; to SwitchLedsOff(); in case 5.
|
|
| Jan 25, 2022 at 21:44 | comment | added | Myles | I have implemented the new code with your help and It works great except for one thing, it doesnt enter state 5 and turn the LEDs LOW with RTS_IN HIGH. I have updated my original post | |
| Jan 25, 2022 at 20:15 | comment | added | Michel Keijzers | You're welcome. | |
| Jan 25, 2022 at 20:06 | vote | accept | Myles | ||
| Jan 25, 2022 at 20:06 | comment | added | Myles | I think you nailed it! This is a lot clearer way of coding it I believe. I will try to implement this into my code and get back to you. I appreciate the quick response. | |
| Jan 25, 2022 at 19:52 | history | edited | Michel Keijzers | CC BY-SA 4.0 |
added 683 characters in body
|
| Jan 25, 2022 at 19:44 | history | answered | Michel Keijzers | CC BY-SA 4.0 |