On the other hand youll notice the case ON is in single quotes meaning its at lease a 2 byte integer. How can i do this Here is my code include Except one thing, if i want to interupt/stop the current state. the code works just fine and doing what i want. What you don't know yet - but if you dare to research it (and I am not sure it would be really appropriate to do this on a microcontroller anyway) - you can really bastardize a switch-case statement (indeed, you can do really weird things with C. Hi Im making myself a arduino watering system, and i ran into some small problems. Trying to use a keypad to fire off functions, and I just can't seem to get it to work, I can can get the input to print to the serial monitor without the switch statementĪs soon as I try putting a switch statement in nothing works. This tutorial shows you how to use switch to turn on one of several different LEDs based on a byte of data received serially. Well given the code in the image the case of int ON can never be reached as the switch is based of a char so case closed. As already has been answered, yes, you can put an if-then construct inside a switch-case (you can even nest switch-case constructs as well). switch.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |