Creating a Traffic Light in MicroC : Exercise 5 - Constructing a Panel

Exercise 5 - Constructing a Panel

This exercise takes you through the process of constructing the panel as shown in the following figure.

Traffic Light Panel
1.
Select Panel Editor from the main Rational Statemate window. The Open Panel window opens.
2.
Enter the name TRAFFIC_LIGHT_PNL for the Panel Name.
3.
To begin the panel design, add a background to separate the input and output elements. Select Create Filled Box from the Panel Graphic Editor and stretch this to fill the panel canvas.
4.
Select the new Filled Box and select Tools >Properties. The Bindings/Properties window opens.
5.
6.
Select the Fill Color field and click Choose... The Color Viewer for PGE window opens. See the figure.
7.
8.
Click Create Free Text, and type Traffic Light System.
9.
10.
Click Push Button and add this element to the panel. See the figure.
Push Button
11.
Click Label Existing Interactor, type the word CHANGE. The label name follows the cursor. Place the label over the push button object and click.
12.
Select the push button object that you created and then select Tools > Bind. Select the following for the binding values for the object labeled CHANGE. See the figure.

Bind Method - Input Output

Controlled by - CHANGE

Element type - Event

Button type - Flash

Note:
The Controlled by: value must be manually typed into the field. All other values are selected from the drop-down menu that opens when clicking on the value.
Push Button Bindings
13.
Click Create Lamp Interactor and create three lamps as shown in the figure.
Lamp Interactors
14.
Select the top lamp interactor and then select Tools > Bind to invoke the object's Bindings/Properties window.

Enter the following information as the Binding values for the object:

Bind Method - Output

Controlled by - RED_LIGHT

Element type - Condition

Button type - Toggle

15.
Click Apply.
16.
Switch to the Properties page by selecting the Bindings/Properties tab. See the figure.
Bindings Page
17.
18.
Properties Page
19.
Select the middle lamp interactor and then select Tools > Bind to invoke the object’s Bindings/Properties window. Enter the following for the Binding values for the object:

Bind Method: Output

Controlled by: YELLOW_LIGHT

Element type: Condition

Button type: Toggle

20.
Click Apply.
21.
Switch to the Properties page by selecting the Bindings/Properties tab and enter the following information for the Property values:

Highlight Color: YELLOW

22.
23.
Select the bottom Lamp Interactor and then select Tools > Bind to invoke the object's Bindings/Properties window.
24.

Bind Method - Output

Controlled by - GREEN_LIGHT

Element type - Condition

Button type - Toggle

25.
Click Apply.
26.
Switch to the Properties page by selecting the Bindings/Properties tab and enter the following for the Property values for the object:

Bind Method - Output

Highlight Color - GREEN

27.
28.
Select File > Save from the PGE and then File > Exit.