![Page 1: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/1.jpg)
Dr. Gary Stewardson, Raymond Boyles
Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a traffic light. Make sure you have your guided notes.
1
Flowcharts
![Page 2: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/2.jpg)
Dr. Gary Stewardson, Raymond Boyles
Flowcharts can be a useful tool that better enable us to organize, problem solve, and brainstorm when we are writing a program. Flowcharts are similar to thinking maps and concept maps we use to organize, problem solve, and brainstorm when we are writing a paper.
Flowcharts
2
![Page 3: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/3.jpg)
Dr. Gary Stewardson, Raymond Boyles
In our last program, we wrote a program to turn on a light for two seconds. Let’s use symbols to represent the logical flow of this program.
Flowcharts
3
![Page 4: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/4.jpg)
Dr. Gary Stewardson, Raymond Boyles
Symbols
Start and Stop symbols represent the beginning or end of a program. These symbols are simply a place holder and are oval.
4
![Page 5: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/5.jpg)
Dr. Gary Stewardson, Raymond Boyles
Input and outputs from the computer can be represented by the parallelogram symbol below. We use this symbol to represent when we turned the light on.
5
Symbols
![Page 6: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/6.jpg)
Dr. Gary Stewardson, Raymond Boyles
Symbols
We can also use this symbol to represent a switch or a touch sensor.
6
![Page 7: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/7.jpg)
Dr. Gary Stewardson, Raymond Boyles
Symbols
Process symbols represent computational action as rectangles or blocks and represent “Action”. For example, we use this symbol to represent the timer counting two seconds.
7
![Page 8: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/8.jpg)
Dr. Gary Stewardson, Raymond Boyles
Symbols
The decision symbol represents a yes/no and is in the shape of a diamond. We use this symbols to represent testing if the counter has counted to two.
8
![Page 9: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/9.jpg)
Dr. Gary Stewardson, Raymond Boyles
Symbols
The decision symbol can also represent if a switch or a touch sensor is pushed or not.
9
![Page 10: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/10.jpg)
Dr. Gary Stewardson, Raymond Boyles
Symbols
The arrow symbols represent the direction of flow in a program. The arrow symbols shows how the logic flows in a computer program.
10
![Page 11: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/11.jpg)
Dr. Gary Stewardson, Raymond Boyles
Complete Flowchart
The connection of all the symbols shows a process. The flowchart to the right represents the process of turning a light on for two seconds, then turning off the light, and then ending the program.
11
![Page 12: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/12.jpg)
Dr. Gary Stewardson, Raymond Boyles
Complete Flowchart
1. Start the process
2. Turn on the light
3. - If (Yes) the time has expired then: Go to Stop- If (No) the time has not expired then keep counting
4. Turn off the light
5. Stop
12
![Page 13: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/13.jpg)
Dr. Gary Stewardson, Raymond Boyles
Flow Chart Activity
Our next program will perform the following so please write these down in your activity guided notes:
• The green light and red light will turn on for two seconds.
• The green and red light will turn off.
• The green and yellow light will turn on for one second
• The green and yellow light will turn off 13
![Page 14: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/14.jpg)
Dr. Gary Stewardson, Raymond Boyles
Flow Chart Activity
Wiring:
• The green light is connected to Port A of the NXT controller and relay 1 on the relay board.
• The yellow light is connected to Port B of the NXT controller and relay 2 on the relay board
• The red light is connected to Port C of the NXT controller and relay 3 on the relay board
14
![Page 15: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/15.jpg)
Dr. Gary Stewardson, Raymond Boyles
Pre-Programming Activity
With the symbols below and the PowerPoint guided notes, create a flow chart that represents a computer program that will logically follow the steps you have just written in your Activity 10 guided notes.
15
![Page 16: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/16.jpg)
Dr. Gary Stewardson, Raymond Boyles
Flow Chart
16
Your flow chart should look something like the flowchart pictured to the right.
![Page 17: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/17.jpg)
Dr. Gary Stewardson, Raymond Boyles
Flow Chart
NXT Object Reference
17
Your computer program should look something like the flowchart pictured to the right.
![Page 18: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/18.jpg)
Dr. Gary Stewardson, Raymond Boyles
Complete Flowchart
Can you flowchart the process of a traffic light?
18
![Page 19: Dr. Gary Stewardson, Raymond Boyles Hello again, Sparkey here. Slippery and I will help you explore how to create a program that simulates outputs on a](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649ccb5503460f94993fff/html5/thumbnails/19.jpg)
Dr. Gary Stewardson, Raymond Boyles
Complete Flowchart
Now, let us complete Activity 10
19