Library Functions for Let’s Start Coding Kits
Libraries are packets of code that give your programs extra capabilities and make complicated code easier to use. Two libraries that are often used with your Let’s Start Coding kit are “MakerScreenXVI” and “LEDStrip”. You will see them at the top of some programs like #include “LEDStrip.h”. On this page we list and explain the major functions of each library as a reference for you.
MakerScreenXVI Library Functions
MakerScreenXVI lcd enter this line of code above the void setup() of your program to get the screen ready to run.
lcd.print() Enter a message between quotation marks, a variable value, or a sensor reading between the parentheses of this function to display it on the screen.
lcd.display()/lcd.noDisplay() Shows or hides the values on your screen without erasing them. Useful for blinking something on the screen.
lcd.clear() Erases whatever is displayed on the screen
lcd.setCursor(x position, y position) Moves the cursor around so that you can center text or display something on the next line. lcd.setCursor(7,0); puts the cursor in the middle of the top row of your screen. X has a range of 0-15 and Y is either 0 or 1.
lcd.backlightOn()/lcd.backlightOff Turns the backlight on or off.
lcd.backlightToggle Toggles the backlight. If it was on, this turns the backlight off. If the backlight was off, this turns it on. Useful for blinking the backlight.
LEDStrip Library Functions
LEDStrip strip = LEDStrip(number of pixels, data pin, clock pin); set up the LED pixels by defining the number of pixels, the data pin, and the clock pin. When using an Ultimate Kit, we always recommend and show that the green data line is connected to pin 13, and the blue clock line is connected to pin 12.
strip.setPixel(pixel, color, brightness) Enter the pixel number (0-14), the color (0-300), & brightness(0-100) for the pixels.
strip.draw() Sends all of your setPixel data to the LED pixels. Without it, nothing will visibly change on your LED strip.
strip.clear() Turns off every LED pixel. Must be followed by a strip.draw(); function to have an effect.
strip.ALL() Use this instead of a pixel number inside the strip.setPixel function and it will turn on every LED pixel when the strip.draw() function runs. This would look like strip.setPixel(strip.ALL,222,98);