Robotics Week 2 Getting Started Using the Display Compiled from various Internet sources Presented by Mr. Hatfield Robotics Week 2 Getting Started Using the Display
Getting Started With task() All programs are run within a function called task main(). The code between the curly braces is the main portion of the program and can do everything. Though not recommended. //All programs use task() to be the start of the program task main(); { //Program code goes here… }
The Display on the EV3 Specs on the Display on the EV3 Pixels - 178 X 128 Regular Text – 16 Lines (0 through 15) Big Text – 8 lines but numbered such as: Line0 Line2 Line4…
Common Display Commands //Displays ROBOTC on line 3 in normal text displayTextLine(3, "ROBOTC"); //Displays ROBOTC on line 3 in big text displayBigTextLine(3, "ROBOTC"); //Displays ROBOTC on line 3 centered and in normal text displayCenteredTextLine(2, "ROBOTC"); //Displays ROBOTC on line 3 centered and in big text displayCenteredBigTextLine(2, "ROBOTC"); Notice how commands end with a semicolon… ;
Are There More Commands? For more commands see the list of commands in ROBOTC and for more usage do a google search for the command followed by ‘ROBOTC’
Using a Variable in the Display //Displays ROBOTC on line 3 in normal text, will display a number variable also int x = 3; displayTextLine(3, “I am %d years old."); sleep (3000); //Displays ‘I am 3 years old.’ on the 3rd line for 3 seconds (3000 milliseconds)
You Can Draw on the EV3 and erase the display //Draws an ellipse with a left coordinate of 5, top coordinate of 10, //right coordinate of 15, and bottom coordinate of 20. drawEllipse(5, 10, 15, 20); and erase the display //Erase the entire LCD display eraseDisplay();
Hello World! (Putting it together) //This program will display ‘Hello World!!!’ centered in big text on line 1 and a simple drawing for 5 seconds. task main() { eraseDisplay(); displayCenteredBigTextLine(1, "Hello World!!!"); drawEllipse(64, 50, 114, 100); drawEllipse(77, 80, 87, 90); drawEllipse(91, 80, 101, 90); drawEllipse(74, 60, 104, 70); sleep(5000); } Now it is your turn…
Download and Start Once you are done with the program press the ‘Download to Robot’ button And then the ‘Start’ button Watch the EV3 display!!!
Congratulations!!! I am assuming that you have a functioning EV3 with ROBOTC I am assuming that you were able to communicate with your EV3 I am assuming that you were able to get your EV3 to display ‘Hello World!!!’