Timeline for Is it possible to run two for loops separated?
Current License: CC BY-SA 3.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 25, 2017 at 9:38 | history | edited | Michel Keijzers | CC BY-SA 3.0 |
added 1550 characters in body
|
Jul 25, 2017 at 8:00 | comment | added | Michel Keijzers | Can you update your question with your current sketch, it's hard to see from here | |
Jul 25, 2017 at 6:51 | comment | added | gamma | Thank you but I still got the problem that only one LED is shining. How can I fix that? | |
Jul 24, 2017 at 20:44 | comment | added | Michel Keijzers | I forgot the delay indeed, I put it at the end | |
Jul 24, 2017 at 20:44 | history | edited | Michel Keijzers | CC BY-SA 3.0 |
added 29 characters in body
|
Jul 24, 2017 at 20:33 | comment | added | gamma | Thanks for your help. Unfortunately it doesn't work. I'm still a beginner in coding so I think I misunderstood something. This is how I try to run my first loop: if (loop1state) { for (loop1index = 0; loop1index<255; loop1index++){ analogWrite(LED,loop1index); } loop1state = loop1index < 256; } I can however compile it but it does not work. I also wanted to ask you how I can change my delay of 10ms? | |
Jul 24, 2017 at 9:40 | comment | added | Michel Keijzers | I updated my answer with your changed requirements, not tested, but the idea is clear I hope | |
Jul 24, 2017 at 9:39 | history | edited | Michel Keijzers | CC BY-SA 3.0 |
added 1397 characters in body
|
Jul 24, 2017 at 8:21 | comment | added | gamma | I just wanted to try your sketch but I get an error at the bottom of the code at the last else loop: "currentTime was not declared in this scope" However, I'm not quite sure if this code will work the way I was thinking of. The wirst loop should start an while x is increasing at the first loop, the second one should start. Time[s]:0..1:Loop 1 starts, 1...2: Loop2 starts while Loop 1 is increasing, 2...3: Loop 3 starts while Loop 1 and 2 are increasing,3...5:all Loops are increasing until 255. In that order Loop 1 reaches 255 first, Loop 2 is second and Loop 3 third. | |
Jul 23, 2017 at 21:48 | comment | added | Michel Keijzers | @ChrisStratton No I like this better, It's more clear I think. | |
Jul 23, 2017 at 21:43 | comment | added | Chris Stratton | Oh,you're absolutely right, sorry about that! Feel free to change it back if you prefer the way you previously had it. | |
Jul 23, 2017 at 21:36 | history | edited | Michel Keijzers | CC BY-SA 3.0 |
added 105 characters in body
|
Jul 23, 2017 at 21:32 | comment | added | Michel Keijzers | @ChrisStratton True, with some addition for 'no-action'parts | |
Jul 23, 2017 at 21:26 | comment | added | Michel Keijzers | @ChrisStratton Updated my answer according to the recalling millis() problem. Delay is possible too indeed (with your remark when possible to use). | |
Jul 23, 2017 at 21:25 | history | edited | Michel Keijzers | CC BY-SA 3.0 |
added 43 characters in body
|
Jul 23, 2017 at 21:01 | history | answered | Michel Keijzers | CC BY-SA 3.0 |