Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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++

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

55. Show that g(t) tet cannot be a moment generating function.

Answered: 1 week ago

Question

Describe the linkages between HRM and strategy formulation. page 74

Answered: 1 week ago

Question

Identify approaches to improving retention rates.

Answered: 1 week ago