Lab 5: DS4Drop — Part 2 Now with Air Resistance Solution

$35.00 $29.05

You'll get a: . zip file solution, download link after Payment



  • Develop problem solving skills

  • Develop skills in the use of numerous loops to solve a problem

Starting Point:

You will be working off of the program you wrote last week. At this point, you should have a program capable of recording the time that has passed while the DualShock 4 falls and determining the distance covered in that fall. Open the file from last week, Save-As with a different file name to start this week because you will need to turn in both files in your lab report.



Depending on your tolerances chosen in your program so far, you may run into problems when you drop the DualShock 4 three stories. What is going on here?

We will add another feature to the program based on a formula that incorporates the magnitude of the acceleration as the DualShock 4 falls. Modify your program to also compute and output the fall distance using the following approach.

At x0=0 , the time can be called t0

and the velocity vi=0 .

As the DualShock 4 falls, the velocity (v) changes as



+ g (1 − mag(acc)) (t​−t​ ).





where g is gravity.

​ ​

Then, the position, x, changes as x

= x


+ v (t −t​ )


i i i-1

So, what should xbe when the DualShock 4 stops falling?


Sample Output

After the output from last week’s lab, after each fall, your program should output:

Compensating for air resistance, the fall was 8.777 meters.

This is 7% less than computed before.

The Drop

After you have implemented the air resistance calculation, rename your source code to

<your username>.c and copy that file to the drop box link on BlackBoard. Be sure to put it in your section. Next, follow your TA’s instructions for completing the actual drop.

Questions and Experiments

  1. How much difference tends to occur in drops in the lab area? From the 2nd floor?

  1. How far is it from the second floor railing to the bottom floor according to your code? If your program is not done by end of this week’s lab, you can capture data ds4rd.exe data to a file using:

./ds4rd.exe -d 054c:05c4 -D DS4_BT -t -g > output.csv

Test your code by running:

./exdrop < lab5_sampledata2013_1.csv

  1. What issues arose in implementing Part 2?


Your lab report will include:

  1. Copy of code for part 1 and 2

  1. Answers to all questions from Lab 5 Part 1’s “Questions and Experiments” and those above.