190 likes | 364 Views
Flowcharts. 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. Flowcharts.
E N D
Flowcharts 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.
Flowcharts 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 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.
Symbols Start and Stop symbols represent the beginning or end of a program. These symbols are simply a place holder and are oval.
Symbols 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.
Symbols We can also use this symbol to represent a switch or a touch sensor.
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.
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.
Symbols The decision symbol can also represent if a switch or a touch sensor is pushed or not.
Symbols The arrow symbols represent the direction of flow in a program. The arrow symbols shows how the logic flows in a computer program.
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.
Complete Flowchart Start the process Turn on the light - If (Yes) the time has expired then: Go to Stop - If (No) the time has not expired then keep counting Turn off the light Stop
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
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
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.
Flow Chart Your flow chart should look something like the flowchart pictured to the right.
Flow Chart NXT Object Reference Your computer program should look something like the flowchart pictured to the right.
Complete Flowchart Can you flowchart the process of a traffic light?
Complete Flowchart Now, let us complete Activity 10