Display Popup Tutorial.

Step 5. Another Display Example.

This step will use what we have learned about displaying text, and using a variable to do so. This example will display the time, date, EZ-B battery voltage, and CPU temperature.

1.) With the "Display Popup" control already added to your ARC project, we will configure it to change the background and font colours, along with the font size and and style. After the changes are made, click "Save".

User-inserted image

2.) Add a new "Script Manager" control to your project, then add a new script.

User-inserted image

3.) Edit the new script, rename it "Display Time" or something of your choosing, then add the following script...

ControlCommand("Display Popup", Display, "" + $time)

Notice it is very similar to the Pandorabot command, with the difference being the variable has changed to "$time".

User-inserted image

After you save the new script, you can test it by clicking "Run" on the script control.

User-inserted image

4.) Save this new script, then add another one, this time naming it something like "Display Date" then add the following script...

ControlCommand("Display Popup", Display, "" + $date)

5.) Add another script, naming it "Display CPU Temp". This script will be a little different to the other two, as we need to set a variable. The script should look like the following...

$cpu = getcputemp()
ControlCommand("Display Popup", Display, "" + $cpu)

6.) Add a further script and add the following for battery voltage...

$voltage = getvoltage()
sleep(100)
ControlCommand("Display Popup", Display, "" + $voltage)

7.) Add a final script, and name it "Display all" or something of your choice, then add the following control commands for all of the above scripts...

$voltage = getvoltage()
sleep(100)
ControlCommand("Script Manager", ScriptStart, "Time Display")
sleep(2000)
ControlCommand("Script Manager", ScriptStart, "Battery Display")
sleep(2000)
ControlCommand("Script Manager", ScriptStart, "Date Display")
sleep(2000)
ControlCommand("Script Manager", ScriptStart, "CPU temp Display")

8.) Connect your EZ-B to EZ-Builder. What you can do now is display one script at a time by clicking "Run" on the relevant script control, or click "Run" on the "Display All" script control, which will scroll through all four scripts at 2 second intervals. (Note: the time and date scripts do not need the EZ-B connected as this info is taken from the computer running EZ Builder).

User-inserted image


ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.