how to write the following arduino program?

Write an Arduino program called two_servos.ino that controls two Servo objects in different ways.
The first Servo object must sweep from 0 to 180 degrees in steps (or units) determined by keyboard input (via serial communication). The range of step sizes valid for this problem is 1 to 90. If any input other than the integers 1-90 is given, you should simply ignore it.
Until an input is given, assume a step size of 1. If and when subsequent inputs are given, the sweeping should adjust immediately to the new step size, without resetting to 0 degrees.
When the position of the servo reaches 180 degrees, it should reset to 0 degrees and continue sweeping.
NOTE: You need to delay a reasonable amount in your loop, so that the complete sweep from 0 to 180 can be seen (i.e., the position does not change too quickly to be observed). Delaying about 500 milliseconds works well.
Control of the second Servo object is your choice. That is, you may move the servo to various positions and place delays between movements. The values used to determine the positions and/or delays can be collected and/or computed in any way you choose. For example, consider collecting values from sensors and/or keyboard input. You can use these inputs as is, or involve these inputs in computations to produce the values used by your servo.
Note that the servo should animate in a way different, and more interesting, than the Lab 6 activity.
Also note that both Servo objects should be controllable at the same time in a single run of your Arduino program.
Most likely your Arduino kit contains only one micro or hobby servo. Partner with a classmate to share servos for completing this assignment. (Do not share servo code for this assignment.) If you are unable to coordinate with a classmate, see the course staff who has several servos that can be loaned out.
During the demos in lab, the course staff will have extra servos for you to use. You should prepare for the demo by wiring one of your servos completely and wiring the other servo partially so that you can simply attach it during the demo.
Zip the Arduino folder that contains your two_servos.ino program and submit the zip file. (The folder should not contain any other files.)
Tutor Answer
