DropBOB Designs

"Custom designs, for everyone!"

Follow DropBOB Designs on Social Media!

Arduino GSM Expandable Vehicle Connection Project

Working on some code today. I discovered the many awesome uses of switch(x){Case(0):} loops in the Arduino code. Here’s how they work:

if (buttons & BUTTON_UP) {                       // If a button is pressed and it is the Up button
          menu = menu – 1;                                 // Adjust the menu item to be the one before
          if (menu<0) menu=3;                            // If you went too far up, cycle through to the bottom
          switch(menu){                                      // Start the switch loop using the “menu” variable
            case 0:                                               // In case the menu = 0
              lcd.setCursor(0,1);                           // Place the LCD cursor at the bottom left
              lcd.print(“1-ChangeSensTrip”);         // Print “1-ChangeSensTrip” on the LCD
              break;                                              // Need this break, otherwise it will continue
            case 1:
              lcd.setCursor(0,1);
              lcd.print(“2)ShowSensorVals”);
              break;
          }
}

Here’s my code on Github if you would like to use it: https://github.com/Phoenix260/Capacitive_Sensor And don’t forget the licence agreement. Personal use only!

I’ll clean it up when I have time.

Enjoy.

FacebookPinterestRedditTwitter

Leave a Reply

Your email address will not be published.

Newsletter

10 Subscribers

Sign up to be part of the journey!

Click here to Sign up for the Pre-Order for Cold-Brew CoffeeMKR PRO. cold brew PRO logo It's FREE to sign up! No obligation. Just gauging interest. Also, first in line gets it first!

Social Feeds:

Copyright © 2018 DropBOB Designs
FacebookPinterestRedditTwitter
FacebookPinterestRedditTwitter