A switch case behave erratically, i'm completely clueless after 8 hours debuggin


I’m making a statemachine to drive a robot welder. I have a problem with a switch case that behave like no switch case should do… I made this debug version ans i’ve been working on it for 8 hour to pinpoint the problem, its the switch case that dont do its job i dont know why… I’ve commented all the switch read to isolate the bad parts, and the siwtch case is alternating between the first two case without any interaction… The rets of teh code seems to works fine. I’ve read a lot and done lots of testing to try to solve it but i’m clueless… I stopped working on the code to test the basic function before continuing and i’m stuck. And dont mention the delays i know it stops the flow it was intentionnal to be able to read the serial output without too many mods.

So thanks for those of you who will look into the issue…


AutoweldStatemachineDEBUG.ino (8.86 KB)

Does this mean you have actually printed the value being used by the switch-case statements and they are all correct? Or how far did you go in determining which case is not being executed?


For a start, and I haven't looked any further, the first and third cases, WAITING and AUTO_WELD, have no


Wow... You see i'm using some things i hvane't played with before.... You were right i modified it and it seems my issue was only cause by my bad uses of the break... Rewritten the code with a break as the last thing to happen in the case and it worked... Thanks a lot you can already close the case! Have a good one!