Changing screen color
Now that you're accustomed to every type of block, it's time to learn how to use them!
There will be a series of small examples where you'll be able to get an understanding of how the Ringo library works.
Each example will show different functionalities. In the end, we'll just bring all of that together to create a cool app!
Let's begin!
Example #1
Let's kick things off as simple as possible.
The main component on Ringo is definitely the screen since working without one would be
pretty much impossible.
What we want to do as a test is to change the screen color of our program.
The default screen color is black, or as it is known in our library, TFT_BLACK.
All colors from this library are labeled with TFT_ prefix because they are made to be used on TFT screens.
The first function that is there by default is mp.display.fillScreen(TFT_BLACK).
It acts as an eraser - everything will be wiped off the screen at the beginning of the program.
It acts as an eraser - everything will be wiped off the screen at the beginning of the program.
Now let's move to the code generated by the blocks.
Since we want to turn our screen cyan, we are calling another fillScreen() function from the Display section, just with a different parameter.
It's only necessary to do this once, so we're placing it in the Arduino run first: a section which is equivalent to the void setup().
Placing it in the loop part would call the functions multiple times a second which is in this example a complete waste of time.
Now that we've made sure everything is set, we can run the program. It will first be compiled and then uploaded to the phone.
Ringo's screen should now be cyan. It's really as simple as that.
This is just a beginning but you can imagine that the possibilities of this screen are countless.
Colors
The full list of available colors can be found in the Display section
Restoring defaults
Now, what if we want to stop making cool things and just use our phone? Well, it takes only a couple of clicks to get everything back to normal.
Anytime you want to restore the original Ringo firmware to your phone, you can do it by pressing the 'Restore Ringo firmware' button on the main menu.
Just don't forget to save the project before exiting!
Now that we've covered the basics, let's head out to something a little bit more advanced.