Question: Homework 2 - Pattern Display II Learning Objective:Use of global variables, if and for statements. Problem:Write a program that prints following pattern in Serial Monitor

Homework 2

- Pattern Display II

Learning Objective:Use of global variables, if and for statements.

Problem:Write a program that prints following pattern in Serial Monitor repeatedly with a delay of 1 second between each iteration

-

--

---

----

-----

------

-------

--------

---------

----------

---------

--------

-------

------

-----

----

---

--

-

Hints:

Use two global variables to keep track of: count how many hyphens to print on each line, increment or decrement this variable

. In loop() func

tion, use a for loop to print number

of hyphens

equal to count on each line.

Use if statements to increment/decrement count and toggle variable

Troubleshoot:

Nothing prints

initialize Serial Monitor.

Software flowchart:

Write your program according to flowchart g

iven on the next page.

C/C++

Homework 2 - Pattern Display II Learning Objective:Use of global variables, if

count=1 total = 10 inc = true Initialize Serial Monitor i=0 Print a hyphen Ves i count Print new line NO Yes inc es true count = count-1 count = count-1 r es Count sto inc = false Yes inc=true delay for 1 Second count == 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!