Practice Lesson - Do/While

Write software to print square root of first 100 natural numbers on the serial console using a Do ... while structure.
Each time a number is printed, the LED connected to pin 13 should blink.
Blinking rate should be 2Hz.

Write software to print square root of first 100 natural numbers on the serial console using a Do ... while structure.

Will I get in trouble for using for loops

Each time a number is printed, the LED connected to pin 13 should blink.

No the serial Tx lights will blink, unless this is what your teacher wants you to do.

Blinking rate should be 2Hz

My arduino is smarter than that, I get 2Hz using a calculator.

no problem with loops.

Using an Arduino Uno, which has an LED on pin 13. It should be told to blink whenever it prints the root to the serial display.

Not a homework or exam or anything - just one of a list of a few scenarios that we can try on our own - but he has no 'answer key.'

b4dbad20cc8d048ebc97a135cf8f3425.media.500x385.jpg

That LED will flash when the pin attached to it is turned on (13 set to output and HIGH).
You could use a <500 ms delay in between steps to slow things down.
Before you print out, turn the LED on
then after sending data turn LED off, or even use a delay to keep it on.

Read the 'blink without delay' example to see a smarter way to control the program flow.

Not a homework or exam or anything - just one of a list of a few scenarios that we can try on our own - but he has no 'answer key.'

Still sounds like school work. You won't learn anything if we do you school work for you.

There are several parts to the assignment.

Write software to print square root of first 100 natural numbers on the serial console

You need to be able to print to the serial console. You need to be able to compute the square root of a value. You need to understand int vs. float, and choose the appropriate storage type. You need to determine how to perform an action a specific number of times. You need to decide whether a value is a natural number or not (whatever that means).

You will learn nothing if we do any of this for you.

If you try something, and it does not work, and you explain what you expected and what you got, we'll be happy to point out what is wrong, and suggest how you might fix it.