Maker Screen Methods and Controls

Topics Covered:

Whenever a programmer writes a program, they make lots of decisions: What will the program do? Will it be one big program or many small parts? Can I use existing code and just change it a bit for my use? 

The same goes for the code library MakerScreenXVI, which is the set of methods and controls that make it easier to use Maker Screen. We decided on the most useful features, what to name them, and how to use them. In this program, you see all of the methods and what they do.

This code will not do anything useful on its own- it's a list of what is possible with the screen with a short explanation of how to use it. Try implementing some of the methods with other screen basics, like using backlightToggle(); with a message on the screen.

/* * The Makerscreen library makes controlling the 16x2 LED screen * easy, with a collection of simple methods to control it. * * NOTE: This code will not compile or upload! It's designed to show * you how the methods work and what arguments they need. Take a method * or two from the loop() and use them in an example program to see * how they work. */ // include the library code: #include "MakerScreenXVI.h" //create an object named 'lcd' in the MakerScreenXVI library. MakerScreenXVI lcd; void setup() { //Include .begin in setup() any time you use the screen. lcd.begin(); } void loop() { //Clear all text off the LCD screen lcd.clear(); //Return the cursor to the (0,0) position (top left) lcd.home(); //Write some text to the screen lcd.write("yourText"); //Stop displaying text on the screen- this is not clearing it lcd.noDisplay(); //Resume displaying text that is written to the screen lcd.display(); //Remove the illustration of the cursor on the screen lcd.noCursor(); //Show an illustration of the cursor on the screen lcd.cursor(); //Set the screen to scroll text to the left lcd.scrollDisplayLeft(); //Set the screen to scroll text to the right lcd.scrollDisplayRight(); //Set the screen to automatically scroll text lcd.autoscroll(); //Disable automatic scrolling of text lcd.noAutoscroll(); //Turn on the LCD backlight lcd.backlightOn(); //Turn off the LCD backlight lcd.backlightOff(); //Switch the LCD backlight off if on, and on if off lcd.backlightToggle(); //Display a bargraph on the LCD, plotting value as a proportion // from lowLimit to highLimit lcd.bargraph(int value, int lowLimit, int highLimit); //Create a custom character, drawn as the binary array below lcd.createChar(2,[0b00110, 0b10110, 0b01100, 0b01111, 0b01110, 0b01011, 0b10000, 0b00000] ); //Set the cursor to the location (y,x) lcd.setCursor(column number,row number); } // (c) 2017 Let's Start Coding. License: