Timeline for RGB LED simulation with Arduino code
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 14 at 15:59 | comment | added | SnappyRiffs | also the case statement is kind of unnecessary and parts of it is redundant | |
Nov 14 at 15:01 | comment | added | SnappyRiffs |
switch case statements should end with break;
|
|
Mar 22, 2022 at 15:41 | comment | added | jsotola |
if(data == '2') and following if s should be else if so that they do not waste time evaluating if one of them is true ... could be replaced by case
|
|
Mar 22, 2022 at 15:39 | comment | added | jsotola |
the program flow was not clear when I looked at it the first time ... the code inside the if(Serial.available()>0 ) block should be indented one more level so that it is clear which code executes when if(Serial.available()>0 ) is true
|
|
Mar 22, 2022 at 15:30 | comment | added | a2640 | I used if because I wanted the serial command response for each of those conditions just printed one time on the serial monitor. And the reason for using switch is because of repeating the function for an unlimited time, while I wouldn't do that with using if. I am still learning and I couldn't find a better solution. If you think there is a better solution for making the code more organized by using just one type of condition, I would be happy to share it with me. | |
Mar 22, 2022 at 3:09 | comment | added | jsotola |
what's the point of using if for most of the program and using case for the rest ... that's just messy programming
|
|
Mar 21, 2022 at 20:17 | vote | accept | a2640 | ||
Mar 21, 2022 at 19:42 | answer | added | Justme | timeline score: 3 | |
Mar 21, 2022 at 19:29 | history | asked | a2640 | CC BY-SA 4.0 |